diff options
author | Jonathan DeMasi <jrdemasi@gmail.com> | 2019-06-06 23:57:00 -0600 |
---|---|---|
committer | Jonathan DeMasi <jrdemasi@gmail.com> | 2019-06-06 23:57:00 -0600 |
commit | a8bccea089c9bfb71e4f168b1341227d47f51d8f (patch) | |
tree | 580140d92e82bf85323884e788c7a7b7de9bcd6a | |
parent | 7019056f536cdae0a38c2fe8e2d6930e8baf4936 (diff) | |
download | gh_authkey_checker-a8bccea089c9bfb71e4f168b1341227d47f51d8f.tar gh_authkey_checker-a8bccea089c9bfb71e4f168b1341227d47f51d8f.tar.gz gh_authkey_checker-a8bccea089c9bfb71e4f168b1341227d47f51d8f.tar.bz2 gh_authkey_checker-a8bccea089c9bfb71e4f168b1341227d47f51d8f.tar.lz gh_authkey_checker-a8bccea089c9bfb71e4f168b1341227d47f51d8f.tar.xz gh_authkey_checker-a8bccea089c9bfb71e4f168b1341227d47f51d8f.tar.zst gh_authkey_checker-a8bccea089c9bfb71e4f168b1341227d47f51d8f.zip |
cleaned up arg parsing
-rw-r--r-- | main.go | 16 |
1 files changed, 5 insertions, 11 deletions
@@ -9,18 +9,12 @@ import ( ) func parseArgs() string { - // Check for at least one arg, bail if none - if len(os.Args) < 2 { - log.Fatalln("You must provide exactly one GitHub username.") + // We can only accept one argument + if len(os.Args) != 2 { + fmt.Println("Usage: gh_authkey_checker <username>") + os.Exit(1) } - - // We have one arg possible comma separated - if len(os.Args) == 2 { - return os.Args[1] - } else { - log.Fatalln("You have provided too many arguments") - } - return "" + return os.Args[1] } func fetchKeys(username string) string { |