summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorEric Lin <anselor@gmail.com>2018-10-06 17:17:17 +0000
committerEric Lin <anselor@gmail.com>2018-10-06 17:17:17 +0000
commit96bcfe012b3b1659dbd0244ac6c4a43dfb5328d6 (patch)
tree53aa46ab12fe2644023ff4ffa22b8beccce086c2 /examples
parent49cbec9969b4b53248d6097d8f395d92c74f7228 (diff)
downloadcmd2-git-96bcfe012b3b1659dbd0244ac6c4a43dfb5328d6.tar.gz
Added handling of nargs=argparse.REMAINDER in both AutoCompleter and ArgparseFunctor
Should correctly force all subsequent arguments to go to the REMAINDER argument once it is detected. Re-arranged the command generation in ArgparseFunctor to print flag arguments before positionals Also forces the remainder arguments to always be last.
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/tab_autocompletion.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/tab_autocompletion.py b/examples/tab_autocompletion.py
index 6a2e683e..6be7f0c8 100755
--- a/examples/tab_autocompletion.py
+++ b/examples/tab_autocompletion.py
@@ -336,7 +336,7 @@ class TabCompleteExample(cmd2.Cmd):
movies_add_parser.add_argument('title', help='Movie Title')
movies_add_parser.add_argument('rating', help='Movie Rating', choices=ratings_types)
movies_add_parser.add_argument('-d', '--director', help='Director', nargs=(1, 2), required=True)
- movies_add_parser.add_argument('actor', help='Actors', nargs='*')
+ movies_add_parser.add_argument('actor', help='Actors', nargs=argparse.REMAINDER)
movies_delete_parser = movies_commands_subparsers.add_parser('delete')
movies_delete_movie_id = movies_delete_parser.add_argument('movie_id', help='Movie ID')