MCPcopy Index your code
hub / github.com/docker/cli / argValue

Method argValue

cli-plugins/hooks/template.go:85–95  ·  view source on GitHub ↗

argValue returns the value of the nth argument.

(n int)

Source from the content-addressed store, hash-verified

83
84// argValue returns the value of the nth argument.
85func (c commandInfo) argValue(n int) (string, error) {
86 if c.cmd == nil {
87 return "", fmt.Errorf("%w: arg: cmd is nil", ErrHookTemplateParse)
88 }
89 flags := c.cmd.Flags()
90 v := flags.Arg(n)
91 if v == "" && n >= flags.NArg() {
92 return "", fmt.Errorf("%w: arg: %dth argument not set", ErrHookTemplateParse, n)
93 }
94 return v, nil
95}

Callers 1

ParseTemplateFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected