Skip to content

Commit bf9b876

Browse files
authored
Merge pull request #883 from python-cmd2/flag_rename
do_set flag rename
2 parents 48cdf7d + 9f599fb commit bf9b876

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Bug Fixes
33
* Corrected issue where the actual new value was not always being printed in do_set. This occurred in cases where
44
the typed value differed from what the setter had converted it to.
5+
* Enhancements
6+
* Renamed set command's `-l/--long` flag to `-v/--verbose` for consistency with help and history commands.
57

68
## 0.10.0 (February 7, 2020)
79
* Enhancements

cmd2/cmd2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2851,7 +2851,7 @@ def complete_set_value(self, text: str, line: str, begidx: int, endidx: int,
28512851
"Call without arguments for a list of all settable parameters with their values.\n"
28522852
"Call with just param to view that parameter's value.")
28532853
set_parser_parent = DEFAULT_ARGUMENT_PARSER(description=set_description, add_help=False)
2854-
set_parser_parent.add_argument('-l', '--long', action='store_true',
2854+
set_parser_parent.add_argument('-v', '--verbose', action='store_true',
28552855
help='include description of parameters when viewing')
28562856
set_parser_parent.add_argument('param', nargs=argparse.OPTIONAL, help='parameter to set or view',
28572857
choices_method=_get_settable_completion_items, descriptive_header='Description')
@@ -2916,7 +2916,7 @@ def do_set(self, args: argparse.Namespace) -> None:
29162916
# Display the results
29172917
for param in sorted(results, key=self.default_sort_key):
29182918
result_str = results[param]
2919-
if args.long:
2919+
if args.verbose:
29202920
self.poutput('{} # {}'.format(utils.align_left(result_str, width=max_len),
29212921
self.settables[param].description))
29222922
else:

tests/test_cmd2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_base_argparse_help(base_app):
7979

8080
def test_base_invalid_option(base_app):
8181
out, err = run_cmd(base_app, 'set -z')
82-
assert err[0] == 'Usage: set [-h] [-l] [param] [value]'
82+
assert err[0] == 'Usage: set [-h] [-v] [param] [value]'
8383
assert 'Error: unrecognized arguments: -z' in err[1]
8484

8585
def test_base_shortcuts(base_app):
@@ -103,7 +103,7 @@ def test_base_show(base_app):
103103
def test_base_show_long(base_app):
104104
# force editor to be 'vim' so test is repeatable across platforms
105105
base_app.editor = 'vim'
106-
out, err = run_cmd(base_app, 'set -l')
106+
out, err = run_cmd(base_app, 'set -v')
107107
expected = normalize(SHOW_LONG)
108108
assert out == expected
109109

0 commit comments

Comments
 (0)