-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprimeIssuesArgs.py
175 lines (160 loc) · 5.32 KB
/
primeIssuesArgs.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
from argparse import ArgumentParser, Namespace
from prime_issues.utils import common
version: str = "0.10.0"
def bugzillaArgs() -> Namespace:
parser: ArgumentParser = ArgumentParser(
prog=f"{common.name} Bugzilla Issues Downloader (BETA)",
description="A tool to download all Issues from a Bugzilla hosted issue tracker",
epilog=f"Author(s): {common.author}",
formatter_class=common.SortingHelpFormatter,
)
parser.add_argument(
"-u",
"--url",
help="Bugzilla repository root url. DEFAULT: https://bugzilla.kernal.org. NOTE: Structure the URL exactly like the DEFAULT or else this will not work.",
type=str,
required=True,
default="https://bugzilla.kernal.org",
)
common.inputFileArg(
parser=parser,
helpMessage="CSV file of exported Bugzilla bugs. DEFAULT: bugzillaIssues.csv",
defaultFile="bugzillaIssues.csv",
)
common.outputFileArg(
parser=parser,
helpMessage="File to save JSON response(s) to. DEFAULT: bugzillaIssues.json",
defaultFile="bugzillaIssues.json",
)
common.versionArg(parser=parser, version=version)
return parser.parse_args()
def githubArgs() -> Namespace:
parser: ArgumentParser = ArgumentParser(
prog=f"{common.name} GitHub Issues Downloader",
description="A tool to download all issues from a GitHub hosted repository",
epilog=f"Author(s): {common.author}",
formatter_class=common.SortingHelpFormatter,
)
parser.add_argument(
"-p",
"--pull-request",
help="Flag to enable the collection of pull requests with the other data",
required=False,
action="store_true",
default=False,
)
parser.add_argument(
"-r",
"--repository",
help="GitHub formatted as repository owner/repository",
type=str,
required=True,
)
common.outputFileArg(
parser=parser,
helpMessage="File to save JSON response(s) to. DEFAULT: githubIssues.json",
defaultFile="githubIssues",
)
parser.add_argument(
"-t",
"--token",
help="GitHub personal access token",
type=str,
required=True,
)
parser.add_argument(
"--log",
help="File to store logs in. DEFAULT: github_issues.log",
type=str,
required=False,
default="github_issues.log",
)
common.versionArg(parser=parser, version=version)
return parser.parse_args()
def gitlabArgs() -> Namespace:
parser: ArgumentParser = ArgumentParser(
prog=f"{common.name} Gitlab Issues Downloader",
description="A tool to download all issues from a Gitlab hosted repository",
epilog=f"Author(s): {common.author}",
formatter_class=common.SortingHelpFormatter,
)
parser.add_argument(
"-r",
"--repository",
help="Gitlab repository ID",
type=str,
required=True,
)
common.outputFileArg(
parser=parser,
helpMessage="File to save JSON response(s) to. DEFAULT: gitlabIssues.json",
defaultFile="gitlabIssues.json",
)
parser.add_argument(
"-t",
"--token",
help="Gitlab personal access token",
type=str,
required=True,
)
parser.add_argument(
"--log",
help="File to store logs in. DEFAULT: gitlab_issues.log",
type=str,
required=False,
default="gitlab_issues.log",
)
common.versionArg(parser=parser, version=version)
return parser.parse_args()
def graphArgs() -> Namespace:
parser: ArgumentParser = ArgumentParser(
prog=f"{common.name} Issues Grapher",
description=f"A tool for graphing Issue information from the output of the {common.name} Issues Downloader.",
epilog=f"Author(s): {common.author}",
formatter_class=common.SortingHelpFormatter,
)
common.inputFileArg(
parser=parser,
helpMessage=f"JSON file from {common.name} Productivity Computer. DEFAULT: githubIssues.json",
defaultFile="githubIssues.json",
)
common.outputFileArg(
parser=parser,
helpMessage="Filename of the graph. DEFAULT: githubIssues.pdf",
defaultFile="githubIssues.pdf",
)
common.plotTypeArg(
parser=parser,
helpMessage="Type of graph to plot. DEFAULT: line",
defaultValue="line",
)
common.plotTitleArg(
parser=parser,
helpMessage="Title of the graph. DEFAULT: Issues",
defaultValue="Issues",
)
common.plotXLabelArg(
parser=parser,
helpMessage="Label of the X axis of the graph. DEFAULT: Days",
defaultValue="Days",
)
common.plotYLabelArg(
parser=parser,
helpMessage="Label of the Y axis of the graph. DEFAULT: Issues",
defaultValue="Issues",
)
common.plotXDataArg(
parser=parser,
helpMessage="Key of the x values to use for graphing. DEFAULT: opened_day_since_0",
defaultValue="opened_day_since_0",
)
parser.add_argument(
"--y-thousandths",
help="Flag to divide the y values by 1000",
action="store_true",
required=False,
default=False,
)
common.plotStylesheetArg(parser=parser)
common.versionArg(parser=parser, version=version)
return parser.parse_args()