Skip to content

Commit df5ede9

Browse files
committed
completion: offer --no-flag for negatable bools
The bash completion engine only suggests --flag but not its negated form. Add --no-<name> candidates for flags that have the negatable tag set. Signed-off-by: Robin Jarry <robin@jarry.cc>
1 parent 8d112ee commit df5ede9

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎pkg/config/completion.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ func bashComplete(app *kong.Kong) bool {
128128
continue
129129
}
130130
add(long, flag.Help)
131+
if flag.Tag.Negatable != "" {
132+
neg := "--no-" + flag.Name
133+
if !seen[neg] {
134+
add(neg, flag.Help)
135+
}
136+
}
131137
}
132138
}
133139

0 commit comments

Comments
 (0)