summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r--ipalib/cli.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index a495924e..d199f721 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -26,6 +26,7 @@ import sys
import code
import optparse
import public
+import errors
def to_cli(name):
@@ -161,14 +162,14 @@ class CLI(object):
while True:
if error is not None:
print '>>> %s: %s' % (option.name, error)
- value = raw_input(prompt)
- if default is not None and len(value) == 0:
- value = default
- if len(value) == 0:
- error = 'Must supply a value'
- else:
- kw[option.name] = value
+ raw = raw_input(prompt)
+ try:
+ value = option(raw)
+ if value is not None:
+ kw[option.name] = value
break
+ except errors.ValidationError, e:
+ error = e.error
cmd(*args, **kw)