Refactor help system to consolidate error messages and command-specific help
- Simplify main help to show brief command descriptions only - Add --help support to all commands with detailed usage information - Replace duplicated help text in error messages with error + help pattern - Remove 'help' command in favor of consistent --help flag usage - Add helper functions CheckForHelpFlag() and ShowErrorWithHelp() for standardization - Refactor deploy command to reduce cognitive complexity and improve maintainability 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
59dd709d83
commit
dee239a3d4
11 changed files with 370 additions and 80 deletions
|
@ -25,8 +25,33 @@ const (
|
|||
)
|
||||
|
||||
func RunUpdateAssetsCommand(args []string, pluginPath string) error {
|
||||
if len(args) > 0 {
|
||||
return fmt.Errorf("updateassets command does not accept arguments")
|
||||
helpText := `Update plugin files from embedded assets
|
||||
|
||||
Usage:
|
||||
pluginctl updateassets [options]
|
||||
|
||||
Options:
|
||||
--help, -h Show this help message
|
||||
|
||||
Description:
|
||||
Updates plugin development files such as Makefile, .editorconfig, build
|
||||
configurations, and other assets from the embedded templates. This ensures
|
||||
your plugin uses the latest development tooling and configurations.
|
||||
|
||||
Examples:
|
||||
pluginctl updateassets # Update assets in current directory
|
||||
pluginctl --plugin-path /path/to/plugin updateassets # Update assets at specific path`
|
||||
|
||||
// Check for help flag
|
||||
if CheckForHelpFlag(args, helpText) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check for unexpected arguments
|
||||
for _, arg := range args {
|
||||
if arg != "--help" && arg != "-h" {
|
||||
return ShowErrorWithHelp(fmt.Sprintf("unknown argument: %s", arg), helpText)
|
||||
}
|
||||
}
|
||||
|
||||
Logger.Info("Updating assets in plugin directory", "path", pluginPath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue