summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd2.py b/cmd2.py
index 9127269b..dacc0526 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -1195,8 +1195,9 @@ class Cmd(cmd.Cmd):
response = int(response)
result = fulloptions[response - 1][0]
break
- except ValueError:
- pass # loop and ask again
+ except (ValueError, IndexError):
+ self.stdout.write("{!r} isn't a valid choice. Pick a number between 1 and {}:\n".format(response,
+ len(fulloptions)))
return result
@options([make_option('-l', '--long', action="store_true", help="describe function of parameter")])