Debian Codegraph @

logistro/_args.py

raw symbols SCIP
1 import argparse
2 import sys
3
4 # Verify arg sanity
5 if "--logistro-human" in sys.argv and "--logistro-structured" in sys.argv:
6 raise ValueError(
7 "Choose either '--logistro-human' or '--logistro-structured'.",
8 )
9
10 parser: argparse.ArgumentParser = argparse.ArgumentParser(add_help=False)
11 """
12 The argsparse parser is exported if you'd like to include it as a parent in your own
13 `argparse.ArgumentParser` and thereby getting better help messages.
14 """
15
16 parser.add_argument(
17 "--logistro-human",
18 action="store_true",
19 dest="human",
20 default=True,
21 help="Format the logs for humans",
22 )
23 parser.add_argument(
24 "--logistro-structured",
25 action="store_false",
26 dest="human",
27 help="Format the logs as JSON",
28 )
29
30 parser.add_argument(
31 "--logistro-level",
32 default=None,
33 type=str,
34 dest="log",
35 help="Set the logging level (no default, fallback to system default)",
36 )
37
38 # Get the Format
39 parsed, remaining_args = parser.parse_known_args()