Skip to content

Commit c085d7b

Browse files
committed
show custom help message when -h is passed
1 parent 4adde7f commit c085d7b

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/mcp/cli.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
MCP CLI - Main entry point for the Model Context Protocol Package Manager CLI
33
"""
44

5-
import sys
65
import click
76
from rich.console import Console
87
from rich.table import Table
@@ -25,23 +24,20 @@
2524
console = Console()
2625
config_manager = ConfigManager()
2726

28-
# Set -h as an alias for --help
29-
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
27+
# Set -h as an alias for --help but we'll handle it ourselves
28+
CONTEXT_SETTINGS = dict(help_option_names=[])
3029

3130
@click.group(context_settings=CONTEXT_SETTINGS, invoke_without_command=True)
31+
@click.option('-h', '--help', 'help_flag', is_flag=True, help='Show this message and exit.')
3232
@click.version_option(version=__version__)
3333
@click.pass_context
34-
def main(ctx):
34+
def main(ctx, help_flag):
3535
"""MCP - Model Context Protocol Package Manager.
3636
3737
A tool for managing MCP servers across various clients.
3838
"""
39-
# If no command was invoked, show the active client and complete command list
40-
if ctx.invoked_subcommand is None:
41-
# Check if help flag was used
42-
if '--help' in sys.argv or '-h' in sys.argv:
43-
# Let Click handle the help display
44-
return
39+
# If no command was invoked or help is requested, show our custom help
40+
if ctx.invoked_subcommand is None or help_flag:
4541

4642
# Get active client
4743
active_client = config_manager.get_active_client()

0 commit comments

Comments
 (0)