Skip to content

Instantly share code, notes, and snippets.

@tbielawa
Last active October 23, 2018 14:01
Show Gist options
  • Save tbielawa/65229a7142c09eb99d325c7683962394 to your computer and use it in GitHub Desktop.
Save tbielawa/65229a7142c09eb99d325c7683962394 to your computer and use it in GitHub Desktop.
$ ./tools/src/oit.py config:print --help
{'odcs_mode': False, 'ignore_missing_base': False, 'group': None, 'images': (), 'sources': None, 'rpms': (), 'latest_parent_version': False, 'quiet': False, 'disabled': False, 'source': (), 'working_dir': None, 'no_oit_comment': False, 'user': None, 'branch': None, 'wip': False, 'debug': False, 'exclude': (), 'metadata': None, 'stage': False}
Usage: oit.py config:print [OPTIONS]
View config for given images / rpms
Options:
-i, --images NAME Name of group image member to include in operation (all
by default). Can be comma delimited list.
-n, --name-only Just print name of matched configs. Overrides --key
--key TEXT Specific key in config to print
-h, --help Show this message and exit.
diff --git a/tools/src/oit.py b/tools/src/oit.py
index 4fa0d71..8b3a5f1 100755
--- a/tools/src/oit.py
+++ b/tools/src/oit.py
@@ -26,10 +26,15 @@ from dockerfile_parse import DockerfileParser
pass_runtime = click.make_pass_decorator(Runtime)
context_settings = dict(help_option_names=['-h', '--help'])
+option_images = click.option("-i", "--images", default=[], metavar='NAME', multiple=True,
+ help="Name of group image member to include in operation (all by default). Can be comma delimited list.")
+
+
# ============================================================================
# GLOBAL OPTIONS: parameters for all commands
# ============================================================================
@click.group(context_settings=context_settings)
+@option_images
@click.option("--metadata-dir", "--metadata", metavar='PATH', default=None,
help="DEPRECATED. For development use only!. Git repo or directory containing groups metadata directory if not current.")
@click.option("--working-dir", metavar='PATH', envvar="OIT_WORKING_DIR",
@@ -43,8 +48,6 @@ context_settings = dict(help_option_names=['-h', '--help'])
@click.option("--branch", default=None, metavar='BRANCH',
help="Branch to override any default in group.yml.")
@click.option('--stage', default=False, is_flag=True, help='Force checkout stage branch for sources in group.yml.')
[email protected]("-i", "--images", default=[], metavar='NAME', multiple=True,
- help="Name of group image member to include in operation (all by default). Can be comma delimited list.")
@click.option("-r", "--rpms", default=[], metavar='NAME', multiple=True,
help="Name of group rpm member to include in operation (all by default). Can be comma delimited list.")
@click.option('--wip', default=False, is_flag=True, help='Load WIP RPMs/Images in addition to those specified, if any')
@@ -1155,6 +1158,7 @@ def config_update(runtime, key, val, push, message):
@cli.command("config:print", help="View config for given images / rpms")
+@option_images
@click.option("-n", "--name-only", default=False, is_flag=True, multiple=True,
help="Just print name of matched configs. Overrides --key")
@click.option("--key", help="Specific key in config to print", default=None)
@pass_runtime
-def config_print(runtime, key, name_only):
+def config_print(runtime, images, key, name_only):
"""
Print name, sub-key, or entire config
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment