From 589d4270657e2894a434de480f1c54b0b8c7da0e Mon Sep 17 00:00:00 2001 From: iaacornus Date: Mon, 6 Jun 2022 18:31:12 +0800 Subject: [PATCH] --setup parameter to setup the program --- cli.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cli.py b/cli.py index 6377460..8055fa3 100644 --- a/cli.py +++ b/cli.py @@ -1,6 +1,7 @@ import argparse from main import main +from setup_program import setup from utils.console import print_substep @@ -21,7 +22,7 @@ def program_options(): action="store_true" ) parser.add_argument( # only accepts the name of subreddit, not links. - "-S", + "-s", "--subreddit", help="Use another sub-reddit.", action="store" @@ -44,6 +45,12 @@ def program_options(): help="Use the given thread link instead of randomized.", action="store" ) + parser.add_argument( + "--setup", + "--setup", + help="Setup the program.", + action="store_true" + ) args = parser.parse_args() @@ -55,6 +62,8 @@ def program_options(): args.filename, args.thread, ) + elif args.setup: + setup() else: print_substep("Error occured!", style="bold red") raise SystemExit() @@ -62,7 +71,8 @@ def program_options(): ConnectionError, KeyboardInterrupt, ): - ... + print_substep("Error occured!", style="bold red") -program_options() +if __name__ == "__main__": + program_options()