MCPcopy
hub / github.com/helm/helm / ExactArgs

Function ExactArgs

pkg/cmd/require/args.go:37–50  ·  view source on GitHub ↗

ExactArgs returns an error if there are not exactly n args.

(n int)

Source from the content-addressed store, hash-verified

35
36// ExactArgs returns an error if there are not exactly n args.
37func ExactArgs(n int) cobra.PositionalArgs {
38 return func(cmd *cobra.Command, args []string) error {
39 if len(args) != n {
40 return fmt.Errorf(
41 "%q requires %d %s\n\nUsage: %s",
42 cmd.CommandPath(),
43 n,
44 pluralize("argument", n),
45 cmd.UseLine(),
46 )
47 }
48 return nil
49 }
50}
51
52// MaximumNArgs returns an error if there are more than N args.
53func MaximumNArgs(n int) cobra.PositionalArgs {

Callers 15

newGetAllCmdFunction · 0.92
newStatusCmdFunction · 0.92
newGetMetadataCmdFunction · 0.92
newRepoIndexCmdFunction · 0.92
newReleaseTestCmdFunction · 0.92
newGetManifestCmdFunction · 0.92
newRepoAddCmdFunction · 0.92
newPluginInstallCmdFunction · 0.92
newVerifyCmdFunction · 0.92
newShowCmdFunction · 0.92
newGetHooksCmdFunction · 0.92
newPluginPackageCmdFunction · 0.92

Calls 1

pluralizeFunction · 0.85

Tested by 1

TestArgsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…