Skip to content

Commit dd8c8fe

Browse files
authored
[GCU] Show default option for '--format' (sonic-net#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. <patch-file-path>: 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. <patch-file-path>: 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:~$ ```
1 parent 626cdc4 commit dd8c8fe

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

config/main.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,8 @@ def print_dry_run_message(dry_run):
11951195
@click.argument('patch-file-path', type=str, required=True)
11961196
@click.option('-f', '--format', type=click.Choice([e.name for e in ConfigFormat]),
11971197
default=ConfigFormat.CONFIGDB.name,
1198-
help='format of config of the patch is either ConfigDb(ABNF) or SonicYang')
1198+
help='format of config of the patch is either ConfigDb(ABNF) or SonicYang',
1199+
show_default=True)
11991200
@click.option('-d', '--dry-run', is_flag=True, default=False, help='test out the command without affecting config state')
12001201
@click.option('-n', '--ignore-non-yang-tables', is_flag=True, default=False, help='ignore validation for tables without YANG models', hidden=True)
12011202
@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
12281229
@click.argument('target-file-path', type=str, required=True)
12291230
@click.option('-f', '--format', type=click.Choice([e.name for e in ConfigFormat]),
12301231
default=ConfigFormat.CONFIGDB.name,
1231-
help='format of target config is either ConfigDb(ABNF) or SonicYang')
1232+
help='format of target config is either ConfigDb(ABNF) or SonicYang',
1233+
show_default=True)
12321234
@click.option('-d', '--dry-run', is_flag=True, default=False, help='test out the command without affecting config state')
12331235
@click.option('-n', '--ignore-non-yang-tables', is_flag=True, default=False, help='ignore validation for tables without YANG models', hidden=True)
12341236
@click.option('-i', '--ignore-path', multiple=True, help='ignore validation for config specified by given path which is a JsonPointer', hidden=True)

0 commit comments

Comments
 (0)