MCPcopy Create free account
hub / github.com/alibaba/open-code-review / validArgNames

Function validArgNames

cmd/opencodereview/arg_errors.go:110–116  ·  view source on GitHub ↗

validArgNames strips the "name\tdescription" form Cobra allows in ValidArgs, keeping only the value the user is expected to type. The split matches the one cobra.OnlyValidArgs applies, so the listed values are exactly those accepted.

(valid []string)

Source from the content-addressed store, hash-verified

108// keeping only the value the user is expected to type. The split matches the one
109// cobra.OnlyValidArgs applies, so the listed values are exactly those accepted.
110func validArgNames(valid []string) []string {
111 names := make([]string, 0, len(valid))
112 for _, v := range valid {
113 names = append(names, strings.SplitN(v, "\t", 2)[0])
114 }
115 return names
116}

Callers 2

TestValidArgNamesFunction · 0.85
argCountErrorFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestValidArgNamesFunction · 0.68