MCPcopy
hub / github.com/rclone/rclone / CheckArgs

Function CheckArgs

cmd/cmd.go:343–353  ·  view source on GitHub ↗

CheckArgs checks there are enough arguments and prints a message if not

(MinArgs, MaxArgs int, cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

341
342// CheckArgs checks there are enough arguments and prints a message if not
343func CheckArgs(MinArgs, MaxArgs int, cmd *cobra.Command, args []string) {
344 if len(args) < MinArgs {
345 _ = cmd.Usage()
346 _, _ = fmt.Fprintf(os.Stderr, "Command %s needs %d arguments minimum: you provided %d non flag arguments: %q\n", cmd.Name(), MinArgs, len(args), args)
347 resolveExitCode(errorNotEnoughArguments)
348 } else if len(args) > MaxArgs {
349 _ = cmd.Usage()
350 _, _ = fmt.Fprintf(os.Stderr, "Command %s needs %d arguments maximum: you provided %d non flag arguments: %q\n", cmd.Name(), MaxArgs, len(args), args)
351 resolveExitCode(errorTooManyArguments)
352 }
353}
354
355// StartStats prints the stats every statsInterval
356//

Callers 15

rcd.goFile · 0.92
lsl.goFile · 0.92
authorize.goFile · 0.92
link.goFile · 0.92
rcat.goFile · 0.92
cryptdecode.goFile · 0.92
rmdir.goFile · 0.92
convmv.goFile · 0.92
deletefile.goFile · 0.92
lsd.goFile · 0.92
copy.goFile · 0.92
ls.goFile · 0.92

Calls 2

resolveExitCodeFunction · 0.85
NameMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…