Skip to content

enhancement: streamline command handling and enhance help output#748

Closed
NamrathShetty wants to merge 1 commit intomodelcontextprotocol:mainfrom
NamrathShetty:main
Closed

enhancement: streamline command handling and enhance help output#748
NamrathShetty wants to merge 1 commit intomodelcontextprotocol:mainfrom
NamrathShetty:main

Conversation

@NamrathShetty
Copy link

@NamrathShetty NamrathShetty commented Nov 3, 2025

This pull request improves the command-line interface of the mcp-publisher tool by adding enhanced help and usage messages for both global and command-specific contexts. It introduces structured help output for each command and refactors argument parsing for better clarity and maintainability.

Improvements to CLI help and usage:

  • Added support for global --help, -h, help, --version, -v, and version flags, displaying usage or version information as appropriate.
  • Introduced command-specific help output via a new printCommandHelp function, providing detailed usage, descriptions, options, and examples for each command (init, login, logout, publish).

Refactoring and maintainability:

  • Refactored argument parsing by extracting the command and its arguments from os.Args, simplifying subsequent command handling and making the code more readable.
  • Updated error messages and help prompts to use the extracted command variable, ensuring consistency in user feedback.

Motivation and Context

How Has This Been Tested?

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

#735

This pull request improves the command-line interface of the mcp-publisher tool by enhancing how help and version information is handled and by adding detailed, command-specific help messages. The changes make the tool more user-friendly and provide clearer guidance for each command.

Improvements to CLI argument handling and help output:

  • Refactored the main command parsing logic in cmd/publisher/main.go to handle global --help, -h, help, --version, -v, and version flags before dispatching to subcommands, ensuring consistent behavior and output for these flags.
  • Added support for displaying command-specific help when --help, -h, or help is passed as the first argument to any subcommand, improving discoverability of command usage.

Addition of detailed command-specific help:

  • Implemented a new printCommandHelp function in cmd/publisher/main.go that provides detailed usage, descriptions, options, and examples for each supported command (init, login, logout, publish), making it easier for users to understand and use each command correctly.

- Refactored main() to handle global help/version flags before command dispatch
- Added command-specific help with --help, -h, or help subcommand support
- Enhanced printCommandHelp() with detailed descriptions, examples, and available options
- Added comprehensive documentation for init, login, logout, and publish commands
- Used fmt.Fprintln with explicit os.Stdout for consistent output handling
- Improved code organization by extracting cmd and args variables early
- Fixed gofmt compliance by adding missing newline at end of file

Signed-off-by: NamrathShetty <namrath.shetty205@gmail.com>
@NamrathShetty NamrathShetty changed the title refactor: streamline command handling and enhance help output enhancement: streamline command handling and enhance help output Nov 6, 2025
@rdimitrov
Copy link
Member

Hey, @NamrathShetty, sorry for the long delay here.
We’re going to move forward in another way to solve this (by moving to a proper CLI framework) which would supersede this, so we’re going to close the PR.

Thanks a lot for the contribution and for your patience and hope you’ll contribute again in the future! 🙏 Cheers!

@rdimitrov rdimitrov closed this Feb 5, 2026
@rdimitrov rdimitrov self-assigned this Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants