summaryrefslogtreecommitdiff
path: root/examples/subcommands.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-15 22:49:36 -0400
committerGitHub <noreply@github.com>2019-07-15 22:49:36 -0400
commit94b424e9c41f99c6eb268c6c97f09e99a8342de8 (patch)
treebcbf724e20fed985f7d05515a10d28ba32112a68 /examples/subcommands.py
parent8109e70b0442206103fa5fe1a3af79d1851d7ec1 (diff)
parent3ad59ceffb9810b774a93448328c7c590080cc98 (diff)
downloadcmd2-git-94b424e9c41f99c6eb268c6c97f09e99a8342de8.tar.gz
Merge pull request #718 from python-cmd2/auto_completer_refactor
Auto completer refactor
Diffstat (limited to 'examples/subcommands.py')
-rwxr-xr-xexamples/subcommands.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/examples/subcommands.py b/examples/subcommands.py
index d1b7c9db..89bcaf85 100755
--- a/examples/subcommands.py
+++ b/examples/subcommands.py
@@ -33,8 +33,7 @@ bar_subparsers.add_parser('cranberries', help='cranberries help')
# create the parser for the "sport" sub-command
parser_sport = base_subparsers.add_parser('sport', help='sport help')
-sport_arg = parser_sport.add_argument('sport', help='Enter name of a sport')
-setattr(sport_arg, 'arg_choices', sport_item_strs)
+sport_arg = parser_sport.add_argument('sport', help='Enter name of a sport', choices=sport_item_strs)
# create the top-level parser for the alternate command
@@ -60,8 +59,7 @@ bar2_subparsers.add_parser('cranberries', help='cranberries help')
# create the parser for the "sport" sub-command
parser_sport2 = base2_subparsers.add_parser('sport', help='sport help')
-sport2_arg = parser_sport2.add_argument('sport', help='Enter name of a sport')
-setattr(sport2_arg, 'arg_choices', sport_item_strs)
+sport2_arg = parser_sport2.add_argument('sport', help='Enter name of a sport', choices=sport_item_strs)
class SubcommandsExample(cmd2.Cmd):