--setup parameter to setup the program

pull/280/head
iaacornus 3 years ago
parent 1e213b8aba
commit 589d427065
No known key found for this signature in database
GPG Key ID: 281739AE7252598C

@ -1,6 +1,7 @@
import argparse import argparse
from main import main from main import main
from setup_program import setup
from utils.console import print_substep from utils.console import print_substep
@ -21,7 +22,7 @@ def program_options():
action="store_true" action="store_true"
) )
parser.add_argument( # only accepts the name of subreddit, not links. parser.add_argument( # only accepts the name of subreddit, not links.
"-S", "-s",
"--subreddit", "--subreddit",
help="Use another sub-reddit.", help="Use another sub-reddit.",
action="store" action="store"
@ -44,6 +45,12 @@ def program_options():
help="Use the given thread link instead of randomized.", help="Use the given thread link instead of randomized.",
action="store" action="store"
) )
parser.add_argument(
"--setup",
"--setup",
help="Setup the program.",
action="store_true"
)
args = parser.parse_args() args = parser.parse_args()
@ -55,6 +62,8 @@ def program_options():
args.filename, args.filename,
args.thread, args.thread,
) )
elif args.setup:
setup()
else: else:
print_substep("Error occured!", style="bold red") print_substep("Error occured!", style="bold red")
raise SystemExit() raise SystemExit()
@ -62,7 +71,8 @@ def program_options():
ConnectionError, ConnectionError,
KeyboardInterrupt, KeyboardInterrupt,
): ):
... print_substep("Error occured!", style="bold red")
if __name__ == "__main__":
program_options() program_options()

Loading…
Cancel
Save