Skip to content

Commit

Permalink
Print usage if no login is provided
Browse files Browse the repository at this point in the history
Co-authored-by: Stephanie Goldstein <stephanieg0@github.com>
  • Loading branch information
schustafa and stephanieg0 committed Jul 25, 2023
1 parent 1ad69f8 commit 525055e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"errors"
"flag"
"fmt"
"os"
Expand All @@ -21,19 +20,23 @@ type userQuery struct {
}

func main() {
flag.Parse()

if len(flag.Args()) < 1 {
fmt.Printf(`
Usage:
pairing-with <github-login>
`)
return
}

if err := cli(); err != nil {
fmt.Fprintf(os.Stderr, "gh-pairing-with failed: %s\n", err.Error())
os.Exit(1)
}
}

func cli() error {
flag.Parse()

if len(flag.Args()) < 1 {
return errors.New("login required")
}

login := strings.ToLower(strings.Join(flag.Args(), " "))

terminal := term.FromEnv()
Expand Down

0 comments on commit 525055e

Please sign in to comment.