1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-03-05 15:15:49 +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 {
ttyText = ttyText + " " + word
type Prompt struct {
pattern string
canAskFor bool
}
prompts := map[string]Prompt{
"password": {
pattern: `Password\s*for\s*'.+':`,
canAskFor: true,
},
"username": {
pattern: `Username\s*for\s*'.+':`,
canAskFor: true,
},
prompts := map[string]string{
"password": `Password\s*for\s*'.+':`,
"username": `Username\s*for\s*'.+':`,
}
for askFor, prompt := range prompts {
if !prompt.canAskFor {
continue
}
if match, _ := regexp.MatchString(prompt.pattern, ttyText); match {
prompt.canAskFor = false
for askFor, pattern := range prompts {
if match, _ := regexp.MatchString(pattern, ttyText); match {
ttyText = ""
return ask(askFor)
}