From a8bccea089c9bfb71e4f168b1341227d47f51d8f Mon Sep 17 00:00:00 2001 From: Jonathan DeMasi Date: Thu, 6 Jun 2019 23:57:00 -0600 Subject: cleaned up arg parsing --- main.go | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index a0f75bb..18969d0 100644 --- a/main.go +++ b/main.go @@ -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 ") + 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 { -- cgit v1.2.3