Commit ef965902 authored by Ignacio Corderi's avatar Ignacio Corderi
Browse files

Added --version to cmd line tool

parent 635fcf06
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2,6 +2,12 @@ Changes since 0.7.3
===========================
This section will document changes to the library since the last release

## Important
- Kinetic Protocol version updated to 3.0.0

## New features
- Added `--version` to cmd line tool

Changes from 0.7.2 to 0.7.3
===========================

+13 −3
Original line number Diff line number Diff line
@@ -26,13 +26,16 @@ import shlex
import socket
import sys

import kinetic
from kinetic import client
from kinetic import PipelinedClient

preparser = argparse.ArgumentParser(add_help=False)
preparser.add_argument('-H', '--hostname', default='localhost')
preparser.add_argument('-P', '--port', type=int, default=8123)
preparser.add_argument('-v', '--verbose', action='count',
preparser.add_argument('-v', '--version', action='store_true',
                       help='Show kinetic version')
preparser.add_argument('-vb', '--verbose', action='count',
                       help='output more info (can stack)')
parser = argparse.ArgumentParser(parents=[preparser])
command_parsers = parser.add_subparsers()
@@ -142,13 +145,14 @@ class Cmd(cmd.Cmd, object):

    prompt = 'kinetic> '
    intro = """
    The Kinetic Drive Command Line Interface Tools
    The Kinetic Protocol Command Line Interface Tools

    type help for commands
    """

    def __init__(self, **options):
        cmd.Cmd.__init__(self)

        hostname = options.get('hostname', 'localhost')
        port = options.get('port', 8123)
        self.client = PipelinedClient(hostname, port)
@@ -276,7 +280,13 @@ def main(args=None):
        args = sys.argv[1:]
    preparse_args, extra_args = preparser.parse_known_args(args)
    configure_logging(preparse_args.verbose)
    if extra_args:

    if preparse_args.version:
        # print version and leave
        print 'kinetic library version "%s"' % kinetic.__version__
        print 'protocol version "%s"' % kinetic.protocol_version
        errorcode = 0
    elif extra_args:
        errorcode = handle_command(args)
    else:
        errorcode = handle_loop(**vars(preparse_args))