Skip to content

Commit

Permalink
add print version
Browse files Browse the repository at this point in the history
  • Loading branch information
resmo committed Dec 24, 2024
1 parent a0ffc6a commit 76ded82
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
16 changes: 14 additions & 2 deletions cs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
CloudStackException,
read_config,
)
from .version import __version__


__all__ = [
Expand Down Expand Up @@ -51,7 +52,7 @@ def _format_json(data, theme):


def main(args=None):
parser = argparse.ArgumentParser(description="Cloustack client.")
parser = argparse.ArgumentParser(description="Cloudstack client.")
parser.add_argument(
"--region",
"-r",
Expand Down Expand Up @@ -92,7 +93,15 @@ def main(args=None):
help="trace the HTTP requests done on stderr",
)
parser.add_argument(
"command", metavar="COMMAND", help="Cloudstack API command to execute"
"command",
metavar="COMMAND",
help="Cloudstack API command to execute",
)

parser.add_argument(
"--version",
action="version",
version=__version__,
)

def parse_option(x):
Expand All @@ -111,6 +120,7 @@ def parse_option(x):
)

options = parser.parse_args(args=args)

command = options.command
kwargs = defaultdict(set)
for arg in options.arguments:
Expand All @@ -128,8 +138,10 @@ def parse_option(x):

if options.post:
config["method"] = "post"

if options.trace:
config["trace"] = True

cs = CloudStack(**config)
ok = True
response = None
Expand Down
1 change: 1 addition & 0 deletions cs/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "3.3.1"
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = cs
version = 3.3.0
version = 3.3.1
url = https://github.com/ngine-io/cs
author = Bruno Renié
description = A simple yet powerful CloudStack API client for Python and the command-line.
Expand Down

0 comments on commit 76ded82

Please sign in to comment.