MCPcopy
hub / github.com/mislav/hub / PromptForPassword

Method PromptForPassword

github/config.go:160–176  ·  view source on GitHub ↗
(host, user string)

Source from the content-addressed store, hash-verified

158}
159
160func (c *Config) PromptForPassword(host, user string) (pass string) {
161 pass = os.Getenv("GITHUB_PASSWORD")
162 if pass != "" {
163 return
164 }
165
166 ui.Printf("%s password for %s (never stored): ", host, user)
167 if ui.IsTerminal(os.Stdin) {
168 if password, err := getPassword(); err == nil {
169 pass = password
170 }
171 } else {
172 pass = c.scanLine()
173 }
174
175 return
176}
177
178func (c *Config) PromptForOTP() string {
179 fmt.Print("two-factor authentication code: ")

Callers 1

authorizeClientMethod · 0.95

Calls 4

scanLineMethod · 0.95
PrintfFunction · 0.92
IsTerminalFunction · 0.92
getPasswordFunction · 0.85

Tested by

no test coverage detected