TotalDepth.common.cmn_cmd_opts (Common Command Line Options)¶
Common command line options, this is to try and present some degree of interface consistency among command line applications.
Copyright (c) 2010-2019 Paul Ross. All rights reserved.
-
TotalDepth.common.cmn_cmd_opts.arg_parser(desc, prog=None, version=None, **kwargs) → argparse.ArgumentParser¶ Return an command line parser with the standard pre-set options.
Standard options are
-h, --versionand:-k: Flag to indicate that we should keep going as far as sensible.-l: Log level.-v: Verbosity.
-
TotalDepth.common.cmn_cmd_opts.path_in(*args, **kwargs) → argparse.ArgumentParser¶ Return an command line parser with the standard pre-set options plus an input path as an argument.
-
TotalDepth.common.cmn_cmd_opts.path_in_out(*args, **kwargs) → argparse.ArgumentParser¶ Return an command line parser with the standard pre-set options plus an input and output paths as an arguments.
-
TotalDepth.common.cmn_cmd_opts.path_in_out_required(*args, **kwargs) → argparse.ArgumentParser¶ Return an command line parser with the standard pre-set options plus an input and output paths as an arguments.
-
TotalDepth.common.cmn_cmd_opts.DEFAULT_OPT_LOG_LEVEL= 30¶ Default log level
-
TotalDepth.common.cmn_cmd_opts.DEFAULT_OPT_LOG_FORMAT= '%(asctime)s %(process)d %(levelname)-8s %(message)s'¶ Default log format (terse)
-
TotalDepth.common.cmn_cmd_opts.DEFAULT_OPT_LOG_FORMAT_VERBOSE= '%(asctime)s - %(filename)-16s#%(lineno)-4d - %(process)5d - (%(threadName)-10s) - %(levelname)-8s - %(message)s'¶ Default log format (verbose)
-
TotalDepth.common.cmn_cmd_opts.add_log_level(parser: argparse.ArgumentParser, level: int = 30) → None¶ Adds log level to the argument parser. The value can be either an integer of a string so 20 and ‘INFO’ are equivalent.
-
TotalDepth.common.cmn_cmd_opts.set_log_level(parsed_args, format: str = '%(asctime)s - %(filename)-16s#%(lineno)-4d - %(process)5d - (%(threadName)-10s) - %(levelname)-8s - %(message)s') → int¶ Initialise logging.
-
TotalDepth.common.cmn_cmd_opts.add_multiprocessing(parser: argparse.ArgumentParser) → None¶ Adds log level to the argument parser as –jobs.
-
TotalDepth.common.cmn_cmd_opts.multiprocessing_requested(parsed_args) → bool¶ Returns True if the
--jobs=option requires multiprocessing.
-
TotalDepth.common.cmn_cmd_opts.number_multiprocessing_jobs(parsed_args) → int¶ Returns the number of multiprocessing nodes interpreted from the``–jobs=`` option.