From 04a4974ffb5288ed771db264822e134227ec8bc7 Mon Sep 17 00:00:00 2001 From: Alessio Date: Wed, 2 Feb 2022 15:09:50 -0800 Subject: [PATCH] Add '-n' / '--number' flags, and update help message for executable --- cmd/twitter/helpers.go | 12 +++++++++++- cmd/twitter/main.go | 6 +++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cmd/twitter/helpers.go b/cmd/twitter/helpers.go index ee22367..cfaf1de 100644 --- a/cmd/twitter/helpers.go +++ b/cmd/twitter/helpers.go @@ -14,7 +14,7 @@ import ( /** * Help message to print if command syntax is incorrect */ -const help_message = `Usage: twitter [--profile ] +const help_message = `Usage: twitter [--profile ] [] This application downloads tweets from twitter and saves them in a SQLite database. : @@ -49,6 +49,16 @@ This application downloads tweets from twitter and saves them in a SQLite databa search is the search query. Should be wrapped in quotes if it has spaces. + +: + -v, --version + Print the version number and exit. + + -n, --number + Set the number of tweets to fetch, when getting a feed. Default is 50. + Setting this flag means you will get at least that many "tweets plus retweets" from that user (unless of + course they don't have that many). The total amount of tweets returned will be larger, because quoted tweets + won't count toward the limit. ` diff --git a/cmd/twitter/main.go b/cmd/twitter/main.go index 52424ab..842c95b 100644 --- a/cmd/twitter/main.go +++ b/cmd/twitter/main.go @@ -24,6 +24,10 @@ func main() { show_version_flag := flag.Bool("version", false, "???") flag.BoolVar(show_version_flag, "v", false, "???") + + how_many := flag.Int("n", 50, "???") + flag.IntVar(how_many, "number", 50, "???") + flag.Parse() args := flag.Args() @@ -66,7 +70,7 @@ func main() { case "fetch_tweet": fetch_tweet_conversation(target) case "get_user_tweets": - fetch_user_feed(target, 50) + fetch_user_feed(target, *how_many) case "get_user_tweets_all": fetch_user_feed(target, 999999999) case "download_tweet_content":