|
@@ -177,19 +177,26 @@ class TclCommand(object):
|
|
|
arguments = []
|
|
arguments = []
|
|
|
n = len(args)
|
|
n = len(args)
|
|
|
|
|
|
|
|
- name = None
|
|
|
|
|
|
|
+ option_name = None
|
|
|
|
|
+
|
|
|
for i in range(n):
|
|
for i in range(n):
|
|
|
match = re.search(r'^-([a-zA-Z].*)', args[i])
|
|
match = re.search(r'^-([a-zA-Z].*)', args[i])
|
|
|
if match:
|
|
if match:
|
|
|
- assert name is None
|
|
|
|
|
- name = match.group(1)
|
|
|
|
|
|
|
+ # assert option_name is None
|
|
|
|
|
+ if option_name is not None:
|
|
|
|
|
+ options[option_name] = None
|
|
|
|
|
+
|
|
|
|
|
+ option_name = match.group(1)
|
|
|
continue
|
|
continue
|
|
|
|
|
|
|
|
- if name is None:
|
|
|
|
|
|
|
+ if option_name is None:
|
|
|
arguments.append(args[i])
|
|
arguments.append(args[i])
|
|
|
else:
|
|
else:
|
|
|
- options[name] = args[i]
|
|
|
|
|
- name = None
|
|
|
|
|
|
|
+ options[option_name] = args[i]
|
|
|
|
|
+ option_name = None
|
|
|
|
|
+
|
|
|
|
|
+ if option_name is not None:
|
|
|
|
|
+ options[option_name] = None
|
|
|
|
|
|
|
|
return arguments, options
|
|
return arguments, options
|
|
|
|
|
|
|
@@ -211,6 +218,7 @@ class TclCommand(object):
|
|
|
for argument in arguments:
|
|
for argument in arguments:
|
|
|
if len(self.arg_names) > idx:
|
|
if len(self.arg_names) > idx:
|
|
|
key, arg_type = arg_names_items[idx]
|
|
key, arg_type = arg_names_items[idx]
|
|
|
|
|
+
|
|
|
try:
|
|
try:
|
|
|
named_args[key] = arg_type(argument)
|
|
named_args[key] = arg_type(argument)
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
@@ -226,7 +234,12 @@ class TclCommand(object):
|
|
|
self.raise_tcl_error('Unknown parameter: %s' % key)
|
|
self.raise_tcl_error('Unknown parameter: %s' % key)
|
|
|
try:
|
|
try:
|
|
|
if key != 'timeout':
|
|
if key != 'timeout':
|
|
|
- named_args[key] = self.option_types[key](options[key])
|
|
|
|
|
|
|
+ # None options are allowed; if None then the defaults are used
|
|
|
|
|
+ # - must be implemented in the Tcl commands
|
|
|
|
|
+ if options[key] is not None:
|
|
|
|
|
+ named_args[key] = self.option_types[key](options[key])
|
|
|
|
|
+ else:
|
|
|
|
|
+ named_args[key] = options[key]
|
|
|
else:
|
|
else:
|
|
|
named_args[key] = int(options[key])
|
|
named_args[key] = int(options[key])
|
|
|
except Exception as e:
|
|
except Exception as e:
|