fix(convoy): Make --notify flag work without argument (gt-qs8ur)

Use NoOptDefVal so --notify defaults to "mayor/" when specified without
a value:

- `--notify` (no arg) -> defaults to "mayor/"
- `--notify ops/` -> uses "ops/"
- (no flag) -> no notification

Removed the mayor-specific auto-default since NoOptDefVal handles this
for all roles.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
rictus
2026-01-01 19:25:21 -08:00
committed by Steve Yegge
parent 478dc60db1
commit dbdf47c37a

View File

@@ -86,7 +86,8 @@ issues across any rig.
Examples: Examples:
gt convoy create "Deploy v2.0" gt-abc bd-xyz gt convoy create "Deploy v2.0" gt-abc bd-xyz
gt convoy create "Release prep" gt-abc --notify mayor/ gt convoy create "Release prep" gt-abc --notify # defaults to mayor/
gt convoy create "Release prep" gt-abc --notify ops/ # notify ops/
gt convoy create "Feature rollout" gt-a gt-b gt-c --molecule mol-release`, gt convoy create "Feature rollout" gt-a gt-b gt-c --molecule mol-release`,
Args: cobra.MinimumNArgs(1), Args: cobra.MinimumNArgs(1),
RunE: runConvoyCreate, RunE: runConvoyCreate,
@@ -133,7 +134,8 @@ Examples:
func init() { func init() {
// Create flags // Create flags
convoyCreateCmd.Flags().StringVar(&convoyMolecule, "molecule", "", "Associated molecule ID") convoyCreateCmd.Flags().StringVar(&convoyMolecule, "molecule", "", "Associated molecule ID")
convoyCreateCmd.Flags().StringVar(&convoyNotify, "notify", "", "Address to notify on completion") convoyCreateCmd.Flags().StringVar(&convoyNotify, "notify", "", "Address to notify on completion (default: mayor/ if flag used without value)")
convoyCreateCmd.Flags().Lookup("notify").NoOptDefVal = "mayor/"
// Status flags // Status flags
convoyStatusCmd.Flags().BoolVar(&convoyStatusJSON, "json", false, "Output as JSON") convoyStatusCmd.Flags().BoolVar(&convoyStatusJSON, "json", false, "Output as JSON")
@@ -173,13 +175,6 @@ func runConvoyCreate(cmd *cobra.Command, args []string) error {
return err return err
} }
// Default --notify to mayor/ when mayor creates a convoy
if convoyNotify == "" {
if roleInfo, err := GetRole(); err == nil && roleInfo.Role == RoleMayor {
convoyNotify = "mayor/"
}
}
// Create convoy issue in town beads // Create convoy issue in town beads
description := fmt.Sprintf("Convoy tracking %d issues", len(trackedIssues)) description := fmt.Sprintf("Convoy tracking %d issues", len(trackedIssues))
if convoyNotify != "" { if convoyNotify != "" {