Skip to content

Commit 54626e7

Browse files
author
Mariano Gappa
committed
Adds -h --help flag for showing usage. #5
1 parent ebcc93d commit 54626e7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

main.go

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"bufio"
5+
"flag"
56
"fmt"
67
"io"
78
"log"
@@ -19,7 +20,18 @@ type database struct {
1920
Pass string
2021
}
2122

23+
var help = flag.Bool("help", false, "shows usage")
24+
25+
func init() {
26+
flag.BoolVar(help, "h", false, "shows usage")
27+
}
28+
2229
func main() {
30+
flag.Parse()
31+
if *help {
32+
usage("")
33+
}
34+
2335
databases := mustReadDatabasesConfigFile()
2436

2537
if len(os.Args[1:]) == 0 {

0 commit comments

Comments
 (0)