Skip to content

Commit 9f20838

Browse files
authored
add print version (#140)
1 parent a0ffc6a commit 9f20838

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

cs/__init__.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
CloudStackException,
2020
read_config,
2121
)
22+
from .version import __version__
2223

2324

2425
__all__ = [
@@ -51,7 +52,7 @@ def _format_json(data, theme):
5152

5253

5354
def main(args=None):
54-
parser = argparse.ArgumentParser(description="Cloustack client.")
55+
parser = argparse.ArgumentParser(description="Cloudstack client.")
5556
parser.add_argument(
5657
"--region",
5758
"-r",
@@ -92,7 +93,15 @@ def main(args=None):
9293
help="trace the HTTP requests done on stderr",
9394
)
9495
parser.add_argument(
95-
"command", metavar="COMMAND", help="Cloudstack API command to execute"
96+
"command",
97+
metavar="COMMAND",
98+
help="Cloudstack API command to execute",
99+
)
100+
101+
parser.add_argument(
102+
"--version",
103+
action="version",
104+
version=__version__,
96105
)
97106

98107
def parse_option(x):
@@ -111,6 +120,7 @@ def parse_option(x):
111120
)
112121

113122
options = parser.parse_args(args=args)
123+
114124
command = options.command
115125
kwargs = defaultdict(set)
116126
for arg in options.arguments:
@@ -128,8 +138,10 @@ def parse_option(x):
128138

129139
if options.post:
130140
config["method"] = "post"
141+
131142
if options.trace:
132143
config["trace"] = True
144+
133145
cs = CloudStack(**config)
134146
ok = True
135147
response = None

cs/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "3.3.1"

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = cs
3-
version = 3.3.0
3+
version = 3.3.1
44
url = https://github.com/ngine-io/cs
55
author = Bruno Renié
66
description = A simple yet powerful CloudStack API client for Python and the command-line.

0 commit comments

Comments
 (0)