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

Function verifyLoginFlags

cli/command/registry/login.go:74–90  ·  view source on GitHub ↗

verifyLoginFlags validates flags set on the command. TODO(thaJeztah); combine with verifyLoginOptions, but this requires rewrites of many tests.

(flags *pflag.FlagSet, opts loginOptions)

Source from the content-addressed store, hash-verified

72//
73// TODO(thaJeztah); combine with verifyLoginOptions, but this requires rewrites of many tests.
74func verifyLoginFlags(flags *pflag.FlagSet, opts loginOptions) error {
75 if flags.Changed("password-stdin") || opts.password == "-" {
76 if flags.Changed("password") && opts.password != "-" {
77 return errors.New("conflicting options: cannot specify both --password and --password-stdin")
78 }
79 if !flags.Changed("username") {
80 return errors.New("the --password-stdin option requires --username to be set")
81 }
82 }
83 if flags.Changed("username") && opts.user == "" {
84 return errors.New("username is empty")
85 }
86 if flags.Changed("password") && opts.password == "" {
87 return errors.New("password is empty")
88 }
89 return nil
90}
91
92// readSecretFromStdin reads the secret from r and returns it as a string.
93// It trims terminal line-endings (LF, CRLF, or CR), which may be added when

Callers 1

newLoginCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…