diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-10 11:36:29 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-10 11:36:29 -0500 |
commit | 9f599fb73a5ce0fb2548b94391883f37a0ca173b (patch) | |
tree | a540014ec1dabbefa48e30289462d3315c85f7ce | |
parent | 48cdf7d984a738e577a0867716804216c474cc18 (diff) | |
download | cmd2-git-9f599fb73a5ce0fb2548b94391883f37a0ca173b.tar.gz |
Renamed set command's -l/--long flag to -v/--verbose for consistency with help and history commands
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | cmd2/cmd2.py | 4 | ||||
-rwxr-xr-x | tests/test_cmd2.py | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e7f7314..0269d287 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ * Bug Fixes * Corrected issue where the actual new value was not always being printed in do_set. This occurred in cases where the typed value differed from what the setter had converted it to. +* Enhancements + * Renamed set command's `-l/--long` flag to `-v/--verbose` for consistency with help and history commands. ## 0.10.0 (February 7, 2020) * Enhancements diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 4fbda57e..8f2cdca3 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -2851,7 +2851,7 @@ class Cmd(cmd.Cmd): "Call without arguments for a list of all settable parameters with their values.\n" "Call with just param to view that parameter's value.") set_parser_parent = DEFAULT_ARGUMENT_PARSER(description=set_description, add_help=False) - set_parser_parent.add_argument('-l', '--long', action='store_true', + set_parser_parent.add_argument('-v', '--verbose', action='store_true', help='include description of parameters when viewing') set_parser_parent.add_argument('param', nargs=argparse.OPTIONAL, help='parameter to set or view', choices_method=_get_settable_completion_items, descriptive_header='Description') @@ -2916,7 +2916,7 @@ class Cmd(cmd.Cmd): # Display the results for param in sorted(results, key=self.default_sort_key): result_str = results[param] - if args.long: + if args.verbose: self.poutput('{} # {}'.format(utils.align_left(result_str, width=max_len), self.settables[param].description)) else: diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index e0b2ba9d..376658e5 100755 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -79,7 +79,7 @@ def test_base_argparse_help(base_app): def test_base_invalid_option(base_app): out, err = run_cmd(base_app, 'set -z') - assert err[0] == 'Usage: set [-h] [-l] [param] [value]' + assert err[0] == 'Usage: set [-h] [-v] [param] [value]' assert 'Error: unrecognized arguments: -z' in err[1] def test_base_shortcuts(base_app): @@ -103,7 +103,7 @@ def test_base_show(base_app): def test_base_show_long(base_app): # force editor to be 'vim' so test is repeatable across platforms base_app.editor = 'vim' - out, err = run_cmd(base_app, 'set -l') + out, err = run_cmd(base_app, 'set -v') expected = normalize(SHOW_LONG) assert out == expected |