-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathninja.py
More file actions
99 lines (94 loc) · 2.94 KB
/
ninja.py
File metadata and controls
99 lines (94 loc) · 2.94 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
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
# Copyright (C) 2024 Max Wiklund
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from clap_python import App, Arg
from clap_python.style import AnsiColor, AnsiStyle, Style, TextStyle
styles = (
Style()
.usage(TextStyle(AnsiColor.Blue, AnsiStyle.Bold))
.headers(TextStyle(AnsiColor.Blue, AnsiStyle.Bold))
.error(TextStyle(AnsiColor.Red))
.flags(TextStyle(AnsiColor.Yellow, AnsiStyle.Bold))
.value_names(TextStyle(AnsiColor.Yellow))
.tip(TextStyle(AnsiColor.Green))
)
def cli() -> dict:
return (
App()
.version("1.12.4")
.style(styles)
.width(170)
.arg(
Arg("--verbose", "-v")
.help("show all command lines while building")
.takes_value(False)
)
.arg(
Arg("--quiet")
.help("don't show progress status, just command output")
.takes_value(False)
)
.arg(
Arg("-C").value_name("DIR").help("change to DIR before doing anything else")
)
.arg(
Arg("-f")
.value_name("FILE")
.help("specify input build file [default=build.ninja]")
)
.arg(
Arg("-j")
.value_name("N")
.help(
"run N jobs in parallel (0 means infinity) [default=10 on this system]"
)
)
.arg(
Arg("-k")
.value_name("N")
.help("keep going until N jobs fail (0 means infinity) [default=1]")
)
.arg(
Arg("-l")
.value_name("N")
.help("do not start new jobs if the load average is greater than N")
)
.arg(
Arg("-n")
.help("dry run (don't run commands but act like they succeeded)")
.takes_value(False)
)
.arg(
Arg("-d")
.value_name("MODE")
.help("enable debugging (use '-d list' to list modes)")
)
.arg(
Arg("-t")
.value_name("Tool")
.help(
(
"run a subtool (use '-t list' to list subtools) terminates "
"toplevel options; further flags are passed to the tool"
)
)
)
.arg(
Arg("-w")
.value_name("FLAG")
.help("adjust warnings (use '-w list' to list warnings)")
)
).parse_args()
if __name__ == "__main__":
args = cli()
print(args)