Skip to content

Instantly share code, notes, and snippets.

@lessless
Created April 2, 2014 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lessless/9930694 to your computer and use it in GitHub Desktop.
Save lessless/9930694 to your computer and use it in GitHub Desktop.
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
}
}
@lessless
Copy link
Author

lessless commented Apr 2, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment