diff --git a/cmd/tests.sh b/cmd/tests.sh index 157e7d8..146747d 100755 --- a/cmd/tests.sh +++ b/cmd/tests.sh @@ -14,6 +14,9 @@ PATH=`pwd`:$PATH test "$(tw --version)" = "v$FAKE_VERSION" +tw --help +test $? -eq 0 + tw create_profile data cd data diff --git a/cmd/twitter/helpers.go b/cmd/twitter/helpers.go index cfaf1de..11614c9 100644 --- a/cmd/twitter/helpers.go +++ b/cmd/twitter/helpers.go @@ -51,6 +51,9 @@ This application downloads tweets from twitter and saves them in a SQLite databa is the search query. Should be wrapped in quotes if it has spaces. : + -h, --help + Print this message, then exit. + -v, --version Print the version number and exit. diff --git a/cmd/twitter/main.go b/cmd/twitter/main.go index 842c95b..2a74815 100644 --- a/cmd/twitter/main.go +++ b/cmd/twitter/main.go @@ -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) }