summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-12-02 16:19:00 -0500
committerRob Crittenden <rcritten@redhat.com>2010-12-02 16:21:31 -0500
commitdf592c6cc8314b2fe520761206fd4e651d4e43c8 (patch)
tree6705fb21cc770065796caaffb4c46998acf24539 /ipalib/cli.py
parentac62447329a25e0b2696e594d3fd3c35da9d69e0 (diff)
downloadfreeipa-df592c6cc8314b2fe520761206fd4e651d4e43c8.tar.gz
freeipa-df592c6cc8314b2fe520761206fd4e651d4e43c8.tar.xz
freeipa-df592c6cc8314b2fe520761206fd4e651d4e43c8.zip
Use better description for group names in help and always prompt for members
When running <foo>-[add|remove]-member completely interactively it didn't prompt for managing membership, it just reported that 0 members were handled which was rather confusing. This will work via a shell if you want to echo too: $ echo "" | ipa group-add-member g1 This returns 0 members because nothing is read for users or group members. $ echo -e "g1\nadmin\n" | ipa group-add-member This adds the user admin to the group g1. It adds it as a user because user membership is prompted for first. ticket 415
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r--ipalib/cli.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 3120e0117..1be392567 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -503,9 +503,11 @@ class textui(backend.Backend):
prompt = u'%s: ' % label
else:
prompt = u'%s [%s]: ' % (label, default)
- return self.decode(
- raw_input(self.encode(prompt))
- )
+ try:
+ data = raw_input(self.encode(prompt))
+ except EOFError:
+ return None
+ return self.decode(data)
def prompt_password(self, label):
"""
@@ -887,8 +889,9 @@ class cli(backend.Executioner):
``self.env.prompt_all`` is ``True``, this method will prompt for any
params that have a missing values, even if the param is optional.
"""
- for param in cmd.params():
- if (param.required and param.name not in kw) or self.env.prompt_all:
+ for param in cmd.params():
+ if (param.required and param.name not in kw) or \
+ param.alwaysask or self.env.prompt_all:
if param.password:
kw[param.name] = self.Backend.textui.prompt_password(
param.label