Skip to content

Commit 0ff0dfe

Browse files
committed
Incorporating requested changes from the PR
1 parent 486f08a commit 0ff0dfe

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

cmd2/cmd2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3233,7 +3233,7 @@ def do_history(self, args: argparse.Namespace) -> None:
32333233
arg = args.arg
32343234
arg_is_int = False
32353235
try:
3236-
_ = int(arg)
3236+
int(arg)
32373237
arg_is_int = True
32383238
except ValueError:
32393239
pass

docs/freefeatures.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,13 @@ You can use negative numbers as either the first or second number of the range
319319
4 alias create four !echo four
320320

321321
Notice the double dashes. These are required because the history command uses
322-
``argparse`` to parse the command line arguments. For reasons I do not
323-
understand, ``argparse`` thinks ``-3:`` is an option, not an argument, but it
324-
thinks ``-3`` is an argument.
322+
``argparse`` to parse the command line arguments. As described in the `argparse
323+
documentation <https://docs.python.org/3/library/argparse.html>`_ , ``-3:`` is
324+
an option, not an argument:
325+
326+
If you have positional arguments that must begin with - and don’t look like
327+
negative numbers, you can insert the pseudo-argument '--' which tells
328+
parse_args() that everything after that is a positional argument:
325329

326330
There is no zeroth command, so don't ask for it. If you are a python programmer,
327331
you've probably noticed this looks a lot like the slice syntax for lists and

0 commit comments

Comments
 (0)