Add simple UI for command-line programs to be able to select when

multiple entries are returned.
This commit is contained in:
Rob Crittenden
2007-12-10 16:12:58 -05:00
parent 2675f35fdf
commit f796e50000
5 changed files with 176 additions and 28 deletions

View File

@@ -21,6 +21,7 @@
import sys
from optparse import OptionParser
import ipa.ipaclient as ipaclient
import ipa.ipaadminutil as ipaadminutil
import ipa.config
import errno
@@ -62,6 +63,7 @@ def main():
counter = groups[0]
groups = groups[1:]
groupindex = -1
if counter == 0:
print "No entries found for", args[1]
return 2
@@ -69,6 +71,14 @@ def main():
print "These results are truncated."
print "Please refine your search and try again."
if counter > 1:
groupindex = ipaadminutil.select_group(counter, groups)
if groupindex == "q":
return 0
if groupindex >= 0:
groups = [groups[groupindex]]
for ent in groups:
try:
members = client.group_members(ent.dn, ['dn','cn'])