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

Function readKey

cli/command/swarm/unlock.go:69–81  ·  view source on GitHub ↗
(in *streams.In, prompt string)

Source from the content-addressed store, hash-verified

67}
68
69func readKey(in *streams.In, prompt string) (string, error) {
70 if in.IsTerminal() {
71 fmt.Print(prompt)
72 dt, err := term.ReadPassword(int(in.FD()))
73 fmt.Println()
74 return string(dt), err
75 }
76 key, err := bufio.NewReader(in).ReadString('\n')
77 if err == io.EOF {
78 err = nil
79 }
80 return strings.TrimSpace(key), err
81}

Callers 1

runUnlockFunction · 0.85

Calls 4

PrintlnMethod · 0.80
IsTerminalMethod · 0.45
PrintMethod · 0.45
FDMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…