Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Jul 25, 2023
1 parent ab59a58 commit 6e46be7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internalActions.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func actionFlags(cmd *cobra.Command) Action {
flagSet := pflagfork.FlagSet{FlagSet: cmd.Flags()}
isShorthandSeries := flagSet.IsShorthandSeries(c.Value)

nospace := make([]rune, 0)
vals := make([]string, 0)
flagSet.VisitAll(func(f *pflagfork.Flag) {
switch {
Expand All @@ -104,6 +105,9 @@ func actionFlags(cmd *cobra.Command) Action {
}
}
vals = append(vals, f.Shorthand, f.Usage, f.Style())
if f.IsOptarg() {
nospace = append(nospace, rune(f.Shorthand[0]))
}
}
} else {
switch f.Mode() {
Expand All @@ -120,7 +124,10 @@ func actionFlags(cmd *cobra.Command) Action {
})

if isShorthandSeries {
return ActionStyledValuesDescribed(vals...).Prefix(c.Value).NoSpace('*')
if len(nospace) > 0 {
return ActionStyledValuesDescribed(vals...).Prefix(c.Value).NoSpace(nospace...)
}
return ActionStyledValuesDescribed(vals...).Prefix(c.Value)
}
return ActionStyledValuesDescribed(vals...).MultiParts(".") // multiparts completion for flags grouped with `.`
}).Tag("flags")
Expand Down

0 comments on commit 6e46be7

Please sign in to comment.