1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-21 22:43:27 +02:00

Removed the username / password savety check

This check is not realy needed because the change that it will show up a second time is so low that this is more work to check than the change it actualy might happen
This commit is contained in:
mjarkk 2018-12-12 21:08:53 +01:00
parent a26c15dafa
commit 0577d3b97f

View File

@ -71,27 +71,13 @@ func (c *OSCommand) DetectUnamePass(command string, ask func(string) string) err
errMessage, err := c.RunCommandWithOutputLive(command, func(word string) string { errMessage, err := c.RunCommandWithOutputLive(command, func(word string) string {
ttyText = ttyText + " " + word ttyText = ttyText + " " + word
type Prompt struct { prompts := map[string]string{
pattern string "password": `Password\s*for\s*'.+':`,
canAskFor bool "username": `Username\s*for\s*'.+':`,
}
prompts := map[string]Prompt{
"password": {
pattern: `Password\s*for\s*'.+':`,
canAskFor: true,
},
"username": {
pattern: `Username\s*for\s*'.+':`,
canAskFor: true,
},
} }
for askFor, prompt := range prompts { for askFor, pattern := range prompts {
if !prompt.canAskFor { if match, _ := regexp.MatchString(pattern, ttyText); match {
continue
}
if match, _ := regexp.MatchString(prompt.pattern, ttyText); match {
prompt.canAskFor = false
ttyText = "" ttyText = ""
return ask(askFor) return ask(askFor)
} }