55import logging
66import os .path
77import sys
8- from . import settings
8+ from . import settings , __version__
99from .create import create
1010from .update import update
1111from .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
2525Available 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
3334For 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