From 024d37d633a05f233f3ef21496987042216042b3 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 6 Feb 2018 16:52:13 -0500 Subject: [PATCH] Add support to show settings detail in nodeconfig settings have lots of text, provide access through '-d' argument --- confluent_client/bin/nodeconfig | 4 ++++ confluent_client/confluent/client.py | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/confluent_client/bin/nodeconfig b/confluent_client/bin/nodeconfig index d23613fb..29b085a0 100755 --- a/confluent_client/bin/nodeconfig +++ b/confluent_client/bin/nodeconfig @@ -47,6 +47,10 @@ argparser.add_option('-c', '--comparedefault', dest='comparedefault', action='store_true', default=False, help='Compare given settings to default or list settings ' 'that are non default') +argparser.add_option('-d', '--detail', dest='detail', + action='store_true', default=False, + help='Provide verbose information as available, such as ' + 'help text and possible valid values') (options, args) = argparser.parse_args() cfgpaths = { diff --git a/confluent_client/confluent/client.py b/confluent_client/confluent/client.py index a61543ad..a49b7a39 100644 --- a/confluent_client/confluent/client.py +++ b/confluent_client/confluent/client.py @@ -376,6 +376,18 @@ def print_attrib_path(path, session, requestargs, options, rename=None): node, printattr, currattr['value'], currattr['default'])) else: + + try: + details = options.detail + except AttributeError: + details = False + if details: + if currattr.get('help', None): + attrtout += ' (Help: {0})'.format( + currattr['help'].encode('utf-8')) + if currattr.get('possible', None): + attrout += ' (Choices: {0})'.format( + ','.join(currattr['possible'])) cprint(attrout) if not exitcode: if requestargs: