@@ -106,8 +106,7 @@ def prompt_yes_no(name, default=True):
106
106
return prompt_bool (name , default = default )
107
107
108
108
109
- def prompt_choices (name , choices , default = None , resolve = ascii_lowercase ,
110
- no_choice = ('none' ,)):
109
+ def prompt_choices (name , choices , default = None , no_choice = ('none' ,)):
111
110
"""Return user input from command line from set of provided choices.
112
111
113
112
:param name: prompt text
@@ -123,7 +122,7 @@ def prompt_choices(name, choices, default=None, resolve=ascii_lowercase,
123
122
options = []
124
123
125
124
for choice in choices :
126
- if isinstance (choice , basestring ) :
125
+ if type (choice ) is str :
127
126
options .append (choice )
128
127
else :
129
128
options .append ("%s [%s]" % (choice [1 ], choice [0 ]))
@@ -134,7 +133,7 @@ def prompt_choices(name, choices, default=None, resolve=ascii_lowercase,
134
133
rv = prompt (name + ' - (%s)' % ', ' .join (options ), default )
135
134
if not rv :
136
135
return default
137
- rv = resolve ( rv )
136
+ rv = rv . lower ( )
138
137
if rv in no_choice :
139
138
return None
140
139
if rv in _choices :
@@ -966,7 +965,9 @@ def main():
966
965
)
967
966
968
967
try :
969
- if args .callback is command_load :
968
+ if not hasattr (args , 'callback' ):
969
+ parser .print_help ()
970
+ elif args .callback is command_load :
970
971
command_load (args )
971
972
elif args .callback is command_convert :
972
973
command_convert (args )
@@ -980,7 +981,5 @@ def main():
980
981
command_attach_session (args )
981
982
elif args .callback is command_kill_session :
982
983
command_kill_session (args )
983
- else :
984
- parser .print_help ()
985
984
except KeyboardInterrupt :
986
985
pass
0 commit comments