Changeset View
Changeset View
Standalone View
Standalone View
scap/arg.py
Show First 20 Lines • Show All 251 Lines • ▼ Show 20 Lines | def get_global_parser(): | ||||
parser = ScapArgParser(formatter_class=ScapHelpFormatter, add_help=False) | parser = ScapArgParser(formatter_class=ScapHelpFormatter, add_help=False) | ||||
# global args are grouped into a separate help section | # global args are grouped into a separate help section | ||||
title = 'global arguments' | title = 'global arguments' | ||||
desc = "Although these arguments can be passed to all scap (sub-)commands,\ | desc = "Although these arguments can be passed to all scap (sub-)commands,\ | ||||
\nnot all commands are affected by every global argument." | \nnot all commands are affected by every global argument." | ||||
group = parser.add_argument_group(title, desc) | group = parser.add_argument_group(title, desc) | ||||
default_loglevel = os.getenv('SCAP_LOG_LEVEL', logging.INFO) | |||||
group.add_argument( | group.add_argument( | ||||
'-c', '--conf', dest='conf_file', | '-c', '--conf', dest='conf_file', | ||||
type=argparse.FileType('r'), | type=argparse.FileType('r'), | ||||
help='Path to configuration file') | help='Path to configuration file') | ||||
group.add_argument( | group.add_argument( | ||||
'--no-shared-authsock', dest='shared_authsock', | '--no-shared-authsock', dest='shared_authsock', | ||||
action='store_false', | action='store_false', | ||||
help='Ignore any shared ssh-auth configuration') | help='Ignore any shared ssh-auth configuration') | ||||
group.add_argument( | group.add_argument( | ||||
'-D', '--define', dest='defines', | '-D', '--define', dest='defines', | ||||
action='append', | action='append', | ||||
type=lambda v: tuple(v.split(':')), | type=lambda v: tuple(v.split(':')), | ||||
help='Set a configuration value', | help='Set a configuration value', | ||||
metavar='<name>:<value>') | metavar='<name>:<value>') | ||||
group.add_argument( | group.add_argument( | ||||
'-v', '--verbose', action='store_const', | '-v', '--verbose', action='store_const', | ||||
const=logging.DEBUG, default=logging.INFO, | const=logging.DEBUG, default=default_loglevel, | ||||
dest='loglevel', help='Verbose output') | dest='loglevel', help='Verbose output') | ||||
group.add_argument( | group.add_argument( | ||||
'-e', '--environment', default=None, | '-e', '--environment', default=None, | ||||
help='environment in which to execute scap') | help='environment in which to execute scap') | ||||
return parser | return parser | ||||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 3.0 (CC-BY-SA) unless otherwise noted; code licensed under GNU General Public License (GPL) or other open source licenses. By using this site, you agree to the Terms of Use, Privacy Policy, and Code of Conduct. · Wikimedia Foundation · Privacy Policy · Code of Conduct · Terms of Use · Disclaimer · CC-BY-SA · GPL