summaryrefslogtreecommitdiff
path: root/examples/subcommands.py
diff options
context:
space:
mode:
authorEric Lin <anselor@gmail.com>2018-05-22 15:07:14 -0400
committerEric Lin <anselor@gmail.com>2018-05-22 15:07:14 -0400
commit3d953628f1dbf7119001fa0751086b3b6016f764 (patch)
tree5802d2d54efba2402a8b13d73c14b6be975ba91b /examples/subcommands.py
parentc2594ff278ac50556cf4781910439ea1977a5873 (diff)
downloadcmd2-git-3d953628f1dbf7119001fa0751086b3b6016f764.tar.gz
Fixes problem with not passing the parameter hint suppression down to sub-commands
Added hint suppression on a per-parameter basis Added helper function to force an parameter to fall back to bash completion instead of using Cmd2 completion. - Hinting is still enabled by default but can be suppressed in the helper function.
Diffstat (limited to 'examples/subcommands.py')
-rwxr-xr-xexamples/subcommands.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/subcommands.py b/examples/subcommands.py
index 3dd2c683..55be7711 100755
--- a/examples/subcommands.py
+++ b/examples/subcommands.py
@@ -19,6 +19,10 @@ base_subparsers = base_parser.add_subparsers(title='subcommands', help='subcomma
parser_foo = base_subparsers.add_parser('foo', help='foo help')
parser_foo.add_argument('-x', type=int, default=1, help='integer')
parser_foo.add_argument('y', type=float, help='float')
+input_file = parser_foo.add_argument('input_file', type=str, help='Input File')
+if __name__ == '__main__':
+ from cmd2.argcomplete_bridge import bash_complete
+ bash_complete(input_file)
# create the parser for the "bar" subcommand
parser_bar = base_subparsers.add_parser('bar', help='bar help')