summaryrefslogtreecommitdiffstats
path: root/jenkins_jobs/cli/parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'jenkins_jobs/cli/parser.py')
-rw-r--r--jenkins_jobs/cli/parser.py97
1 files changed, 55 insertions, 42 deletions
diff --git a/jenkins_jobs/cli/parser.py b/jenkins_jobs/cli/parser.py
index 768daa45..37942654 100644
--- a/jenkins_jobs/cli/parser.py
+++ b/jenkins_jobs/cli/parser.py
@@ -22,8 +22,10 @@ from stevedore import extension
def __version__():
- return "Jenkins Job Builder version: %s" % \
- jenkins_jobs.version.version_info.version_string()
+ return (
+ "Jenkins Job Builder version: %s"
+ % jenkins_jobs.version.version_info.version_string()
+ )
def create_parser():
@@ -31,67 +33,78 @@ def create_parser():
"""
parser = argparse.ArgumentParser()
parser.add_argument(
- '--conf',
- dest='conf',
- default=os.environ.get('JJB_CONF', None),
- help="configuration file [JJB_CONF]")
+ "--conf",
+ dest="conf",
+ default=os.environ.get("JJB_CONF", None),
+ help="configuration file [JJB_CONF]",
+ )
parser.add_argument(
- '-l',
- '--log_level',
- dest='log_level',
- default=os.environ.get('JJB_LOG_LEVEL', 'info'),
- help="log level (default: %(default)s) [JJB_LOG_LEVEL]")
+ "-l",
+ "--log_level",
+ dest="log_level",
+ default=os.environ.get("JJB_LOG_LEVEL", "info"),
+ help="log level (default: %(default)s) [JJB_LOG_LEVEL]",
+ )
parser.add_argument(
- '--ignore-cache',
- action='store_true',
- dest='ignore_cache',
+ "--ignore-cache",
+ action="store_true",
+ dest="ignore_cache",
default=None,
help="ignore the cache and update the jobs anyhow (that will "
- "only flush the specified jobs cache)")
+ "only flush the specified jobs cache)",
+ )
parser.add_argument(
- '--flush-cache',
- action='store_true',
- dest='flush_cache',
+ "--flush-cache",
+ action="store_true",
+ dest="flush_cache",
default=None,
- help="flush all the cache entries before updating")
+ help="flush all the cache entries before updating",
+ )
parser.add_argument(
- '--version',
- dest='version',
- action='version',
+ "--version",
+ dest="version",
+ action="version",
version=__version__(),
- help="show version")
+ help="show version",
+ )
parser.add_argument(
- '--allow-empty-variables',
- action='store_true',
- dest='allow_empty_variables',
+ "--allow-empty-variables",
+ action="store_true",
+ dest="allow_empty_variables",
default=None,
- help="Don\'t fail if any of the variables inside any string are "
- "not defined, replace with empty string instead.")
+ help="Don't fail if any of the variables inside any string are "
+ "not defined, replace with empty string instead.",
+ )
parser.add_argument(
- '--server', '-s',
- dest='section',
- default=os.environ.get('JJB_SECTION', 'jenkins'),
+ "--server",
+ "-s",
+ dest="section",
+ default=os.environ.get("JJB_SECTION", "jenkins"),
help="The Jenkins server ini section to use. Defaults to 'jenkins' "
- "[JJB_SECTION]")
+ "[JJB_SECTION]",
+ )
parser.add_argument(
- '--user', '-u',
- default=os.environ.get('JJB_USER', None),
+ "--user",
+ "-u",
+ default=os.environ.get("JJB_USER", None),
help="The Jenkins user to use for authentication. This overrides "
- "the user specified in the configuration file. [JJB_USER]")
+ "the user specified in the configuration file. [JJB_USER]",
+ )
parser.add_argument(
- '--password', '-p',
- default=os.environ.get('JJB_PASSWORD', None),
+ "--password",
+ "-p",
+ default=os.environ.get("JJB_PASSWORD", None),
help="Password or API token to use for authenticating towards Jenkins."
" This overrides the password specified in the configuration file."
- " [JJB_PASSWORD]")
+ " [JJB_PASSWORD]",
+ )
subparser = parser.add_subparsers(
- dest='command',
- help="update, test, list or delete job")
+ dest="command", help="update, test, list or delete job"
+ )
extension_manager = extension.ExtensionManager(
- namespace='jjb.cli.subcommands',
- invoke_on_load=True,
+ namespace="jjb.cli.subcommands", invoke_on_load=True
)
def parse_subcommand_args(ext, subparser):