mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-15 01:34:26 +02:00
rename arg
This commit is contained in:
@ -139,9 +139,9 @@ func (c *OSCommand) RunCommandWithOutputLive(command string, output func(string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DetectUnamePass detect a username / password question in a command
|
// DetectUnamePass detect a username / password question in a command
|
||||||
// ask is a function that gets executen when this function detect you need to fillin a password
|
// promptUserForCredential is a function that gets executed when this function detect you need to fillin a password
|
||||||
// The ask argument will be "username" or "password" and expects the user's password or username back
|
// The promptUserForCredential argument will be "username" or "password" and expects the user's password or username back
|
||||||
func (c *OSCommand) DetectUnamePass(command string, ask func(string) string) error {
|
func (c *OSCommand) DetectUnamePass(command string, promptUserForCredential func(string) string) error {
|
||||||
ttyText := ""
|
ttyText := ""
|
||||||
errMessage := c.RunCommandWithOutputLive(command, func(word string) string {
|
errMessage := c.RunCommandWithOutputLive(command, func(word string) string {
|
||||||
ttyText = ttyText + " " + word
|
ttyText = ttyText + " " + word
|
||||||
@ -155,7 +155,7 @@ func (c *OSCommand) DetectUnamePass(command string, ask func(string) string) err
|
|||||||
for pattern, askFor := range prompts {
|
for pattern, askFor := range prompts {
|
||||||
if match, _ := regexp.MatchString(pattern, ttyText); match {
|
if match, _ := regexp.MatchString(pattern, ttyText); match {
|
||||||
ttyText = ""
|
ttyText = ""
|
||||||
return ask(askFor)
|
return promptUserForCredential(askFor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user