Skip to content

Commit 8bb1148

Browse files
committed
refactor(cli): use optionalArg("id") for team get positional validator
cobra.MaximumNArgs(1) was the only direct cobra-validator use in the cli package. The optionalArg helper is the project idiom for an optional positional that has a flag alternative (its doc comment describes exactly this case), and it yields the consistent "expects at most one id" error instead of cobra's default terse message.
1 parent 58e8230 commit 8bb1148

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

internal/cli/team.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Examples:
105105
flashduty team get --name "SRE Team"
106106
flashduty team get --ref-id "hr-dept-42"
107107
flashduty team get --id 123 --json`, "Teams", "ReadInfo"),
108-
Args: cobra.MaximumNArgs(1),
108+
Args: optionalArg("id"),
109109
PreRunE: func(cmd *cobra.Command, args []string) error {
110110
if len(args) == 1 {
111111
return nil

0 commit comments

Comments
 (0)