Add '-n' / '--number' flags, and update help message for executable

This commit is contained in:
Alessio 2022-02-02 15:09:50 -08:00
parent 359c166363
commit 04a4974ffb
2 changed files with 16 additions and 2 deletions

View File

@ -14,7 +14,7 @@ import (
/**
* Help message to print if command syntax is incorrect
*/
const help_message = `Usage: twitter [--profile <profile_dir>] <operation> <TARGET>
const help_message = `Usage: twitter [--profile <profile_dir>] [<flags>] <operation> <TARGET>
This application downloads tweets from twitter and saves them in a SQLite database.
<profile_dir>:
@ -49,6 +49,16 @@ This application downloads tweets from twitter and saves them in a SQLite databa
search
<TARGET> is the search query. Should be wrapped in quotes if it has spaces.
<flags>:
-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.
`

View File

@ -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":