From 902a20e25b3f2d584f48f87cdd4f9332cc66a15c Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Thu, 12 Jun 2014 01:34:34 +0000 Subject: [PATCH] starting to make sense --- klugman/klugman.py | 39 +++++++++++++++++++++++++++++++++------ klugman/v1.py | 15 +++++++++++++++ klugman/v2.py | 15 +++++++++++++++ requirements.txt | 1 + 4 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 klugman/v1.py create mode 100644 klugman/v2.py create mode 100644 requirements.txt diff --git a/klugman/klugman.py b/klugman/klugman.py index 72e38ea..7231e6c 100644 --- a/klugman/klugman.py +++ b/klugman/klugman.py @@ -13,14 +13,41 @@ # See the License for the specific language governing permissions and # limitations under the License. -import argparse +"""Klugman - cmdline and client library for StackTach.v3 + +Usage: + klugman.py [-a , --api_version=][--url=] [...] + klugman.py (-h | --help) + klugman.py --version + +Options: + -h --help Show this screen. + --version Show version. + -a , --api_version= Which API version to use + [default: latest] + --url= StackTach.v3 server url [default: http://localhost] + +""" + +from docopt import docopt -parser = argparse.ArgumentParser(description='OpenStack.v3 Client.') +import v1 +import v2 -parser.add_argument('url', dest='url', - help='StackTach.v3 host url') +versions = {1: v1, 2: v2} +latest = 2 -parser.add_argument('cmd', dest='cmd') -args = parser.parse_args() +if __name__ == '__main__': + arguments = docopt(__doc__) + print arguments + + version = arguments["--api_version"][0] + if version == "latest": + version = latest + else: + version = int(version) + impl = versions[version] + + argv = [arguments['']] + arguments[''] diff --git a/klugman/v1.py b/klugman/v1.py new file mode 100644 index 0000000..35e946f --- /dev/null +++ b/klugman/v1.py @@ -0,0 +1,15 @@ +# Copyright (c) 2014 Dark Secret Software Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/klugman/v2.py b/klugman/v2.py new file mode 100644 index 0000000..35e946f --- /dev/null +++ b/klugman/v2.py @@ -0,0 +1,15 @@ +# Copyright (c) 2014 Dark Secret Software Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e5ed2a0 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +docopt