const ( pluginName = "gh" ) // Commands defines all supported GitHub plugin commands and their flags. type ( Commands struct { Create *CreateCommand `arg:"subcommand:create"` } CreateCommand struct { Issue *CreateIssueCommand `arg:"subcommand:issue"` } CreateIssueCommand struct { Type string `arg:"positional"` Namespace string `arg:"-n,--namespace"` } ) // Execute returns a given command as a response. func (e *GHExecutor) Execute(ctx context.Context, in executor.ExecuteInput) (executor.ExecuteOutput, error) { // ... var cmd Commands pluginx.ParseCommand(pluginName, in.Command, &cmd) if cmd.Create == nil || cmd.Create.Issue == nil { return executor.ExecuteOutput{ Data: fmt.Sprintf("Usage: %s create issue KIND/NAME", pluginName), }, nil } // ... }