-
Notifications
You must be signed in to change notification settings - Fork 4
/
ct-config
executable file
·36 lines (31 loc) · 1.18 KB
/
ct-config
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
#! /usr/bin/python3
import sys
import configargparse
import ct.utils
import ct.cake
def main(argv=None):
cap = configargparse.getArgumentParser()
ct.cake.Cake.add_arguments(cap)
if argv is None:
# Output of stdout is done via increasing the verbosity
sys.argv.append("-vvv")
args = ct.apptools.parseargs(cap, argv)
# Note that when the "--write-out-config-file" is in effect that
# we never get to this print. configargparse exits before this which is
# annoying.
print()
return 0
if __name__ == "__main__":
config_files = ct.configutils.config_files_from_variant()
cap = configargparse.getArgumentParser(
description="Helper tool for examining how config files, command line "
"arguments and environment variables are combined. "
"Write the config to file with -w.",
formatter_class=configargparse.ArgumentDefaultsHelpFormatter,
auto_env_var_prefix="",
default_config_files=config_files,
args_for_setting_config_path=["-c", "--config"],
ignore_unknown_config_file_keys=True,
args_for_writing_out_config_file=["-w", "--write-out-config-file"],
)
sys.exit(main())