From dd8c8feba4e428a15f20cfb6fec9ef4128549cdf Mon Sep 17 00:00:00 2001 From: Mohamed Ghoneim Date: Wed, 12 Jan 2022 15:42:43 -0800 Subject: [PATCH] [GCU] Show default option for '--format' (#2003) #### What I did Show the default enum for the option `--format` #### How I did it Added `show_default=True` #### How to verify it Checkout output below #### Previous command output (if the output of a command-line utility has changed) ```bash admin@vlab-01:~$ sudo config apply-patch -h Usage: config apply-patch [OPTIONS] PATCH_FILE_PATH Apply given patch of updates to Config. A patch is a JsonPatch which follows rfc6902. This command can be used do partial updates to the config with minimum disruption to running processes. It allows addition as well as deletion of configs. The patch file represents a diff of ConfigDb(ABNF) format or SonicYang format. : Path to the patch file on the file-system. Options: -f, --format [CONFIGDB|SONICYANG] format of config of the patch is either ConfigDb(ABNF) or SonicYang -d, --dry-run test out the command without affecting config state -v, --verbose print additional details of what the operation is doing -h, -?, --help Show this message and exit. admin@vlab-01:~$ ``` #### New command output (if the output of a command-line utility has changed) ```sh admin@vlab-01:~$ sudo config apply-patch -h Usage: config apply-patch [OPTIONS] PATCH_FILE_PATH Apply given patch of updates to Config. A patch is a JsonPatch which follows rfc6902. This command can be used do partial updates to the config with minimum disruption to running processes. It allows addition as well as deletion of configs. The patch file represents a diff of ConfigDb(ABNF) format or SonicYang format. : Path to the patch file on the file-system. Options: -f, --format [CONFIGDB|SONICYANG] format of config of the patch is either ConfigDb(ABNF) or SonicYang [default: CONFIGDB] -d, --dry-run test out the command without affecting config state -v, --verbose print additional details of what the operation is doing -h, -?, --help Show this message and exit. admin@vlab-01:~$ ``` --- config/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config/main.py b/config/main.py index 4f3ce4b6fc37..f5ecd70048b1 100644 --- a/config/main.py +++ b/config/main.py @@ -1195,7 +1195,8 @@ def print_dry_run_message(dry_run): @click.argument('patch-file-path', type=str, required=True) @click.option('-f', '--format', type=click.Choice([e.name for e in ConfigFormat]), default=ConfigFormat.CONFIGDB.name, - help='format of config of the patch is either ConfigDb(ABNF) or SonicYang') + help='format of config of the patch is either ConfigDb(ABNF) or SonicYang', + show_default=True) @click.option('-d', '--dry-run', is_flag=True, default=False, help='test out the command without affecting config state') @click.option('-n', '--ignore-non-yang-tables', is_flag=True, default=False, help='ignore validation for tables without YANG models', hidden=True) @click.option('-i', '--ignore-path', multiple=True, help='ignore validation for config specified by given path which is a JsonPointer', hidden=True) @@ -1228,7 +1229,8 @@ def apply_patch(ctx, patch_file_path, format, dry_run, ignore_non_yang_tables, i @click.argument('target-file-path', type=str, required=True) @click.option('-f', '--format', type=click.Choice([e.name for e in ConfigFormat]), default=ConfigFormat.CONFIGDB.name, - help='format of target config is either ConfigDb(ABNF) or SonicYang') + help='format of target config is either ConfigDb(ABNF) or SonicYang', + show_default=True) @click.option('-d', '--dry-run', is_flag=True, default=False, help='test out the command without affecting config state') @click.option('-n', '--ignore-non-yang-tables', is_flag=True, default=False, help='ignore validation for tables without YANG models', hidden=True) @click.option('-i', '--ignore-path', multiple=True, help='ignore validation for config specified by given path which is a JsonPointer', hidden=True)