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

Method flagValue

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

flagValue returns the value that was set for the given flag when the hook was invoked.

(flagName string)

Source from the content-addressed store, hash-verified

71
72// flagValue returns the value that was set for the given flag when the hook was invoked.
73func (c commandInfo) flagValue(flagName string) (string, error) {
74 if c.cmd == nil {
75 return "", fmt.Errorf("%w: flagValue: cmd is nil", ErrHookTemplateParse)
76 }
77 f := c.cmd.Flag(flagName)
78 if f == nil {
79 return "", fmt.Errorf("%w: flagValue: no flags found", ErrHookTemplateParse)
80 }
81 return f.Value.String(), nil
82}
83
84// argValue returns the value of the nth argument.
85func (c commandInfo) argValue(n int) (string, error) {

Callers 1

ParseTemplateFunction · 0.95

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected