Skip to content

Commit

Permalink
Print help when run without args
Browse files Browse the repository at this point in the history
  • Loading branch information
sona-tar committed Mar 4, 2015
1 parent ee712c5 commit 8a97e6c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions option.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,26 @@ func GhsOptionParser() ([]string, GhsOptions) {
printGhsOption(args, opts)

if err != nil {
printGhsHelp(parser)
os.Exit(1)
ghsOptionError(parser)
}

if opts.Version {
fmt.Printf("ghs %s\n", version)
os.Exit(0)
}

if (opts.User == "" && opts.Repository == "") && len(args) == 0 {
ghsOptionError(parser)
}

return args, opts
}

func ghsOptionError(parser *flags.Parser) {
printGhsHelp(parser)
os.Exit(1)
}

func printGhsOption(args []string, opts GhsOptions) {
debug.Printf("args = %v\n", args)

Expand Down

0 comments on commit 8a97e6c

Please sign in to comment.