aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go18
1 files changed, 6 insertions, 12 deletions
diff --git a/main.go b/main.go
index f214a09..32ddf6c 100644
--- a/main.go
+++ b/main.go
@@ -8,15 +8,6 @@ import (
"os"
)
-func parseArgs() (string, error) {
- // We can only accept one argument
- if len(os.Args) != 2 {
- return "", fmt.Errorf("Usage: gh_authkey_checker <username>")
- }
-
- return os.Args[1], nil
-}
-
func fetchKeys(username string) (string, error) {
url := fmt.Sprintf("https://github.com/%s.keys", username)
resp, err := http.Get(url)
@@ -42,11 +33,14 @@ func fetchKeys(username string) (string, error) {
}
func main() {
- username, err := parseArgs()
- if err != nil {
- log.Fatal(err)
+ // Ensure we have the correct number of arguments
+ if len(os.Args) != 2 {
+ fmt.Println("Usage: gh_authkey_checker <username>")
+ os.Exit(1)
}
+ username := os.Args[1]
+
log.Printf("Fetching keys for user %s", username)
keys, err := fetchKeys(username)
if err != nil {