-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli_argparse.py
More file actions
47 lines (44 loc) · 1.36 KB
/
cli_argparse.py
File metadata and controls
47 lines (44 loc) · 1.36 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
38
39
40
41
42
43
44
45
46
47
import argparse
from argparse import RawTextHelpFormatter
EPILOG_TEXT = """Examples:
$ python main.py -o path/to/old.json -n path/to/new.json
$ python main.py -d 3
"""
def create_argparser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
description="""Python CLI tools to parse two Fedora Rawhide composes and return lists of packages that
have been removed, added or changed between the two versions.""",
epilog=EPILOG_TEXT,
formatter_class=RawTextHelpFormatter,
)
parser.add_argument(
"-o",
"--old-rpm",
dest="old_rpm",
type=str,
help="Filepath to old compose JSON file",
)
parser.add_argument(
"-n",
"--new-rpm",
dest="new_rpm",
type=str,
default="payload.rpms.Everything.x86_64",
help="Filepath to new compose JSON file",
)
parser.add_argument(
"-p",
"--prefix",
dest="json_prefix",
type=str,
default="payload.rpms.Everything.x86_64",
help="The prefix used to specify the JSON object to parse from the files, default: payload.rpms.Everything.x86_64",
)
parser.add_argument(
"-d",
"--days-ago",
dest="days_ago",
type=int,
help="Number of days ago to get the latest compose dir from thew web and exits",
)
return parser