flags.ValidValueOrExit and os.Exit on Help
This commit is contained in:
parent
9932a84286
commit
c19b11e115
5 changed files with 32 additions and 24 deletions
3
um.go
3
um.go
|
|
@ -18,7 +18,7 @@ const (
|
|||
sort Subcommand = "sort"
|
||||
)
|
||||
|
||||
var help string = fmt.Sprintf("um [%s | %s | %s | %s]", tag, next, last, sort)
|
||||
var help string = fmt.Sprintf("um [%s | %s | %s | %s] [--help | -h]", tag, next, last, sort)
|
||||
|
||||
func main() {
|
||||
// TODO: do something useful:
|
||||
|
|
@ -41,6 +41,7 @@ func main() {
|
|||
case sort:
|
||||
sortpkg.Sort(args)
|
||||
default:
|
||||
fmt.Println("command not found")
|
||||
fmt.Println(help)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue