diff --git a/confluent_client/bin/nodelist b/confluent_client/bin/nodelist index b6892e53..462ed922 100755 --- a/confluent_client/bin/nodelist +++ b/confluent_client/bin/nodelist @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/libexec/platform-python # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2015-2017 Lenovo @@ -15,13 +15,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -__author__ = 'jjohnson2,alin37' +__author__ = 'jjohnson2,alin37,wgrzeda' import optparse import os import signal import sys + + try: signal.signal(signal.SIGPIPE, signal.SIG_DFL) except AttributeError: @@ -39,9 +41,12 @@ def main(): " or: %prog [options] noderange ...") argparser.add_option('-b', '--blame', action='store_true', help='Show information about how attributes inherited') + argparser.add_option('-d', '--delim', metavar="STRING", default = "\n", + help='Delimiter separating the values') (options, args) = argparser.parse_args() noderange="" nodelist="" + list = [] try: noderange = args[0] nodelist = '/noderange/{0}/nodes/'.format(noderange) @@ -61,7 +66,9 @@ def main(): sys.stderr.write(res['error'] + '\n') exitcode = 1 else: - print(res['item']['href'].replace('/', '')) + elem=(res['item']['href'].replace('/', '')) + list.append(elem) + print(options.delim.join(list)) sys.exit(exitcode) diff --git a/confluent_client/doc/man/nodelist.ronn b/confluent_client/doc/man/nodelist.ronn index d2fc5ff5..bfe5a86b 100644 --- a/confluent_client/doc/man/nodelist.ronn +++ b/confluent_client/doc/man/nodelist.ronn @@ -4,7 +4,7 @@ nodelist(8) -- List confluent nodes and their attributes ## SYNOPSIS `nodelist ` -`nodelist [-b] ...` +`nodelist [-b] [-d] {string} ...` ## DESCRIPTION @@ -24,7 +24,8 @@ all attributes that begin with `net.` and end with `switch`. * `-b`, `--blame`: Annotate inherited and expression based attributes to show their base value. - +* `-d`, `--delim`: + Choose a delimiter to separat the values. Default - ENTER. ## EXAMPLES * Listing matching nodes of a simple noderange: `# nodelist n1-n4`