X Tutup
Skip to content

Commit db8204d

Browse files
committed
Allow space to be added after completing issue/pr list --state values
The "nospace" directive instructs the shell completion logic to avoid adding a space after completing the word. However, this feature was broken in an older Cobra, and users still saw a space character added. In most case we want the space because we anticipate that the user might want to add extra arguments to the command.
1 parent 3e8f075 commit db8204d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/cmd/issue/list/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
8383
cmd.Flags().StringSliceVarP(&opts.Labels, "label", "l", nil, "Filter by labels")
8484
cmd.Flags().StringVarP(&opts.State, "state", "s", "open", "Filter by state: {open|closed|all}")
8585
_ = cmd.RegisterFlagCompletionFunc("state", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
86-
return []string{"open", "closed", "all"}, cobra.ShellCompDirectiveNoSpace
86+
return []string{"open", "closed", "all"}, cobra.ShellCompDirectiveNoFileComp
8787
})
8888
cmd.Flags().IntVarP(&opts.LimitResults, "limit", "L", 30, "Maximum number of issues to fetch")
8989
cmd.Flags().StringVarP(&opts.Author, "author", "A", "", "Filter by author")

pkg/cmd/pr/list/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
8585
cmd.Flags().IntVarP(&opts.LimitResults, "limit", "L", 30, "Maximum number of items to fetch")
8686
cmd.Flags().StringVarP(&opts.State, "state", "s", "open", "Filter by state: {open|closed|merged|all}")
8787
_ = cmd.RegisterFlagCompletionFunc("state", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
88-
return []string{"open", "closed", "merged", "all"}, cobra.ShellCompDirectiveNoSpace
88+
return []string{"open", "closed", "merged", "all"}, cobra.ShellCompDirectiveNoFileComp
8989
})
9090
cmd.Flags().StringVarP(&opts.BaseBranch, "base", "B", "", "Filter by base branch")
9191
cmd.Flags().StringSliceVarP(&opts.Labels, "label", "l", nil, "Filter by labels")

0 commit comments

Comments
 (0)
X Tutup