Skip to content

Commit e38c120

Browse files
committed
Prints the version.
1 parent 4866480 commit e38c120

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

zstash/main.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import logging
66
import os.path
77
import sys
8-
from . import settings
8+
from . import settings, __version__
99
from .create import create
1010
from .update import update
1111
from .extract import extract
@@ -20,9 +20,10 @@ def main():
2020
logging.basicConfig(format='%(levelname)s: %(message)s',
2121
level=logging.DEBUG)
2222
parser = argparse.ArgumentParser(
23-
usage='''zstash <command> [<args>]
23+
usage='''For {}, zstash <command> [<args>]
2424
2525
Available zstash commands:
26+
version print the version of zstash
2627
create create new archive
2728
update update existing archive
2829
extract extract files from archive
@@ -32,14 +33,16 @@ def main():
3233
3334
For help with a specific command
3435
zstash command --help
35-
''')
36+
'''.format(__version__))
3637
parser.add_argument('command',
3738
help='command to run (create, update, extract, ...)')
3839
# parse_args defaults to [1:] for args, but you need to
3940
# exclude the rest of the args too, or validation will fail
4041
args = parser.parse_args(sys.argv[1:2])
4142

42-
if args.command == 'create':
43+
if args.command == 'version':
44+
print(__version__)
45+
elif args.command == 'create':
4346
create()
4447
elif args.command == 'update':
4548
update()

0 commit comments

Comments
 (0)