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

Function validArgNames

cmd/opencodereview/arg_errors.go:99–105  ·  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

97// keeping only the value the user is expected to type. The split matches the one
98// cobra.OnlyValidArgs applies, so the listed values are exactly those accepted.
99func validArgNames(valid []string) []string {
100 names := make([]string, 0, len(valid))
101 for _, v := range valid {
102 names = append(names, strings.SplitN(v, "\t", 2)[0])
103 }
104 return names
105}

Callers 2

TestValidArgNamesFunction · 0.85
argCountErrorFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestValidArgNamesFunction · 0.68