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

Function minimumArgs

cmd/opencodereview/arg_errors.go:34–41  ·  view source on GitHub ↗

minimumArgs behaves like cobra.MinimumNArgs(n) but reports too few arguments with the command's own usage information.

(n int)

Source from the content-addressed store, hash-verified

32// minimumArgs behaves like cobra.MinimumNArgs(n) but reports too few arguments
33// with the command's own usage information.
34func minimumArgs(n int) cobra.PositionalArgs {
35 return func(cmd *cobra.Command, args []string) error {
36 if len(args) >= n {
37 return nil
38 }
39 return argCountError(cmd, fmt.Sprintf("requires at least %d argument(s)", n))
40 }
41}
42
43// argCountError assembles the guidance for a wrong argument count. The count the
44// user supplied is deliberately not echoed back — it adds nothing they do not

Callers 2

delegate_cmd.goFile · 0.85

Calls 1

argCountErrorFunction · 0.85

Tested by 1