Created
April 2, 2014 09:16
-
-
Save lessless/9930694 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func LoginCommand(c *cli.Context) string, error { | |
var password, account string | |
var err error | |
account = c.Args()[0] | |
if len(c.Args()) == 0 { | |
fmt.Print("Account: ") | |
if _, err = fmt.Scanln(&account); err == nil { | |
fmt.Print("Password: ") | |
_, err = fmt.Scanln(&password) | |
} | |
} else if len(c.Args()) == 1 { | |
prompt := fmt.Sprintf("Enter password for %s: ", account) | |
password, err = gopass.GetPass(a[0].(string)) | |
} | |
if err == nil { | |
return Login(account, password) | |
} | |
else { | |
return "", err | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ou forgot to fix line 13 and that else on line 19 is useless
also, move line 4 after 11 so that if len(args) == 0 it won't panic