Add '-h, --help' flag to print help message then exit
This commit is contained in:
parent
2773214855
commit
13170c84b2
@ -14,6 +14,9 @@ PATH=`pwd`:$PATH
|
||||
|
||||
test "$(tw --version)" = "v$FAKE_VERSION"
|
||||
|
||||
tw --help
|
||||
test $? -eq 0
|
||||
|
||||
tw create_profile data
|
||||
cd data
|
||||
|
||||
|
@ -51,6 +51,9 @@ This application downloads tweets from twitter and saves them in a SQLite databa
|
||||
<TARGET> is the search query. Should be wrapped in quotes if it has spaces.
|
||||
|
||||
<flags>:
|
||||
-h, --help
|
||||
Print this message, then exit.
|
||||
|
||||
-v, --version
|
||||
Print the version number and exit.
|
||||
|
||||
|
@ -28,6 +28,9 @@ func main() {
|
||||
how_many := flag.Int("n", 50, "???")
|
||||
flag.IntVar(how_many, "number", 50, "???")
|
||||
|
||||
help := flag.Bool("help", false, "???")
|
||||
flag.BoolVar(help, "h", false, "???")
|
||||
|
||||
flag.Parse()
|
||||
args := flag.Args()
|
||||
|
||||
@ -40,6 +43,10 @@ func main() {
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if *help {
|
||||
die("", true, 0)
|
||||
}
|
||||
|
||||
if len(args) < 2 {
|
||||
die("", true, 1)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user