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

Function verifyLoginOptions

cli/command/registry/login.go:124–148  ·  view source on GitHub ↗
(dockerCLI command.Streams, opts *loginOptions)

Source from the content-addressed store, hash-verified

122}
123
124func verifyLoginOptions(dockerCLI command.Streams, opts *loginOptions) error {
125 if opts.password == "-" {
126 opts.password = ""
127 opts.passwordStdin = true
128 }
129
130 if opts.password != "" {
131 _, _ = fmt.Fprintln(dockerCLI.Err(), "WARNING! Using --password via the CLI is insecure. Use --password-stdin.")
132 }
133
134 if opts.passwordStdin {
135 if opts.user == "" {
136 return errors.New("username is empty")
137 }
138 p, err := readSecretFromStdin(dockerCLI.In())
139 if err != nil {
140 return err
141 }
142 if strings.TrimSpace(p) == "" {
143 return errors.New("password is empty")
144 }
145 opts.password = p
146 }
147 return nil
148}
149
150func runLogin(ctx context.Context, dockerCLI command.Cli, opts loginOptions) error {
151 if err := verifyLoginOptions(dockerCLI, &opts); err != nil {

Callers 1

runLoginFunction · 0.85

Calls 3

readSecretFromStdinFunction · 0.85
ErrMethod · 0.65
InMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…