-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlistit.py
More file actions
37 lines (30 loc) · 1.08 KB
/
listit.py
File metadata and controls
37 lines (30 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import configparser
import argparse
from actions.actions import *
##########################
# Functions
##########################
##########################
#Args
##########################
parser = argparse.ArgumentParser(description='CLI Reddit: Listit')
parser.add_argument('-sr', '-subreddit', help="Enter the subreddit (no /r)")
parser.add_argument('-view', '-v', help="Pass the id of the post you want to view")
parser.add_argument('-browser', '-b', help="Pass the id of the post you want to view in your browser")
parser.add_argument('-comments', '-c', help="Pass the id of the post to view the comments")
parser.add_argument('-ct', '-comment_tree', help="Pass the id of the comment to view the comment tree")
args = parser.parse_args()
action = None
if args.sr:
action = SubredditAction(args.sr)
if args.view:
action = ViewAction(args.view)
if args.browser:
action = BrowserAction(args.browser)
if args.comments:
action = CommentsAction(args.comments)
if args.ct:
action = CommentTree(args.ct)
if action == None:
action = ListitAction()
action.execute()