summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2013-07-29 23:13:18 +0200
committerArthur de Jong <arthur@arthurdejong.org>2013-08-18 19:21:31 +0200
commit724a75ff167ccbafe11b879f05310cc525f88093 (patch)
treeb4eb788bee7c4beb8a49bac0bd586b938d24ae0f /utils
parent882f7be5360fa94db9c65607b0ee6925aa4f2f56 (diff)
Improve error and help output of getent command
Diffstat (limited to 'utils')
-rwxr-xr-xutils/getent.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/utils/getent.py b/utils/getent.py
index d662272..039a48c 100755
--- a/utils/getent.py
+++ b/utils/getent.py
@@ -31,15 +31,25 @@ import constants
from nslcd import NslcdClient
+epilog = '''
+supported databases:
+ aliases, ethers, group, group.bymember, hosts, hostsv4, hostsv6,
+ netgroup, netgroup.norec, networks, networksv4, networksv6, passwd,
+ protocols, rpc, services, shadow
+
+Report bugs to <%s>.
+'''.strip() % constants.PACKAGE_BUGREPORT
+
# set up command line parser
parser = argparse.ArgumentParser(
- description='Query information in LDAP.',
- epilog='Report bugs to <%s>.' % constants.PACKAGE_BUGREPORT)
+ formatter_class=argparse.RawDescriptionHelpFormatter,
+ description='Query information in LDAP via nslcd.',
+ epilog=epilog)
parser.add_argument('-V', '--version', action=VersionAction)
parser.add_argument('database', metavar='DATABASE',
- help='any of those supported by nslcd')
+ help='any database supported by nslcd')
parser.add_argument('key', metavar='KEY', nargs='?',
- help='information to lookup')
+ help='filter returned database values by key')
def getent_aliases(database, key=None):
@@ -339,5 +349,5 @@ if __name__ == '__main__':
else:
parser.error('Unknown database: %s' % args.database)
except struct.error:
- print 'Problem contacting nslcd'
+ print 'Problem communicating with nslcd'
sys.exit(1)