MCPcopy Create free account
hub / github.com/cli/cli / NoArgsQuoteReminder

Function NoArgsQuoteReminder

pkg/cmdutil/args.go:56–78  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

54}
55
56func NoArgsQuoteReminder(cmd *cobra.Command, args []string) error {
57 if len(args) < 1 {
58 return nil
59 }
60
61 errMsg := fmt.Sprintf("unknown argument %q", args[0])
62 if len(args) > 1 {
63 errMsg = fmt.Sprintf("unknown arguments %q", args)
64 }
65
66 hasValueFlag := false
67 cmd.Flags().Visit(func(f *pflag.Flag) {
68 if f.Value.Type() != "bool" {
69 hasValueFlag = true
70 }
71 })
72
73 if hasValueFlag {
74 errMsg += "; please quote all values that have spaces"
75 }
76
77 return FlagErrorf("%s", errMsg)
78}
79
80// Partition takes a slice of any type T and separates it into two slices
81// of the same type based on the provided predicate function. Any item

Callers

nothing calls this directly

Calls 2

FlagErrorfFunction · 0.85
TypeMethod · 0.45

Tested by

no test coverage detected