|
2 | 2 | MCP CLI - Main entry point for the Model Context Protocol Package Manager CLI |
3 | 3 | """ |
4 | 4 |
|
5 | | -import sys |
6 | 5 | import click |
7 | 6 | from rich.console import Console |
8 | 7 | from rich.table import Table |
|
25 | 24 | console = Console() |
26 | 25 | config_manager = ConfigManager() |
27 | 26 |
|
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=[]) |
30 | 29 |
|
31 | 30 | @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.') |
32 | 32 | @click.version_option(version=__version__) |
33 | 33 | @click.pass_context |
34 | | -def main(ctx): |
| 34 | +def main(ctx, help_flag): |
35 | 35 | """MCP - Model Context Protocol Package Manager. |
36 | 36 | |
37 | 37 | A tool for managing MCP servers across various clients. |
38 | 38 | """ |
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: |
45 | 41 |
|
46 | 42 | # Get active client |
47 | 43 | active_client = config_manager.get_active_client() |
|
0 commit comments