MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / ExactArgs

Function ExactArgs

pkg/usage/usage.go:30–39  ·  view source on GitHub ↗

Argument validation helper which emits a UsageError rather than a plain string error

(n int)

Source from the content-addressed store, hash-verified

28
29// Argument validation helper which emits a UsageError rather than a plain string error
30func ExactArgs(n int) cobra.PositionalArgs {
31 return func(cmd *cobra.Command, args []string) error {
32 if len(args) != n {
33 return NewUsageError(
34 fmt.Sprintf("accepts %d arg(s), received %d", n, len(args)),
35 cmd)
36 }
37 return nil
38 }
39}

Callers 12

NewCmdViewFunction · 0.92
NewCmdViewFunction · 0.92
NewCmdViewFunction · 0.92
NewCmdViewFunction · 0.92
NewCmdViewFunction · 0.92
NewCmdViewFunction · 0.92
NewCmdViewFunction · 0.92
NewCmdViewFunction · 0.92
NewCmdViewFunction · 0.92
NewCmdViewFunction · 0.92
NewCmdViewFunction · 0.92
NewCmdViewFunction · 0.92

Calls 1

NewUsageErrorFunction · 0.85

Tested by

no test coverage detected