feat: Add gcloud-style command grouping to gt help output
Organize 43 commands into 7 logical groups using cobra's built-in AddGroup/GroupID feature: - Work Management: spawn, sling, hook, handoff, done, mol, mq, etc. - Agent Management: mayor, witness, refinery, deacon, polecat, etc. - Communication: mail, nudge, broadcast, peek - Services: daemon, start, stop, up, down, shutdown - Workspace: rig, crew, init, install, git-init, namepool - Configuration: account, theme, hooks, issue, completion - Diagnostics: status, doctor, prime, version, help Also renamed molecule to mol as the primary command name (molecule is now an alias). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,10 +32,36 @@ func Execute() {
|
||||
}
|
||||
}
|
||||
|
||||
// Command group IDs - used by subcommands to organize help output
|
||||
const (
|
||||
GroupWork = "work"
|
||||
GroupAgents = "agents"
|
||||
GroupComm = "comm"
|
||||
GroupServices = "services"
|
||||
GroupWorkspace = "workspace"
|
||||
GroupConfig = "config"
|
||||
GroupDiag = "diag"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Enable prefix matching for subcommands (e.g., "gt ref at" -> "gt refinery attach")
|
||||
cobra.EnablePrefixMatching = true
|
||||
|
||||
// Define command groups (order determines help output order)
|
||||
rootCmd.AddGroup(
|
||||
&cobra.Group{ID: GroupWork, Title: "Work Management:"},
|
||||
&cobra.Group{ID: GroupAgents, Title: "Agent Management:"},
|
||||
&cobra.Group{ID: GroupComm, Title: "Communication:"},
|
||||
&cobra.Group{ID: GroupServices, Title: "Services:"},
|
||||
&cobra.Group{ID: GroupWorkspace, Title: "Workspace:"},
|
||||
&cobra.Group{ID: GroupConfig, Title: "Configuration:"},
|
||||
&cobra.Group{ID: GroupDiag, Title: "Diagnostics:"},
|
||||
)
|
||||
|
||||
// Put help and completion in a sensible group
|
||||
rootCmd.SetHelpCommandGroupID(GroupDiag)
|
||||
rootCmd.SetCompletionCommandGroupID(GroupConfig)
|
||||
|
||||
// Global flags can be added here
|
||||
// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user