switch to version 0.4.0, added --version parameter

This commit is contained in:
Darko Poljak 2014-01-28 09:09:31 +01:00
parent 55279e1aee
commit c7f34614dd

View file

@ -2,7 +2,7 @@
# Author: Darko Poljak <darko.poljak@gmail.com> # Author: Darko Poljak <darko.poljak@gmail.com>
# License: GPLv3 # License: GPLv3
"""Sweeper. """sweeper 0.4.0
Usage: sweeper.py [options] [<directory>...] Usage: sweeper.py [options] [<directory>...]
@ -11,6 +11,7 @@ Arguments:
Options: Options:
-h, --help show this screen -h, --help show this screen
-v, --version show version and exit
-b <blocksize>, --block-size=<blocksize> size of block used when reading -b <blocksize>, --block-size=<blocksize> size of block used when reading
file's content [default: 4096] file's content [default: 4096]
-d <hashalg>, --digest-alg=<hashalg> secure hash algorithm [default: md5] -d <hashalg>, --digest-alg=<hashalg> secure hash algorithm [default: md5]
@ -34,7 +35,7 @@ Options:
""" """
__author__ = 'Darko Poljak <darko.poljak@gmail.com>' __author__ = 'Darko Poljak <darko.poljak@gmail.com>'
__version__ = '0.3.0' __version__ = '0.4.0'
__license__ = 'GPLv3' __license__ = 'GPLv3'
__all__ = [ __all__ = [
@ -149,6 +150,10 @@ def main():
print('Invalid block size "%s"' % args['--block-size']) print('Invalid block size "%s"' % args['--block-size'])
sys.exit(1) sys.exit(1)
if args['--version']:
print("sweeper %s" % __version__)
return
if action == 'print' or action == 'pprint': if action == 'print' or action == 'pprint':
dups = file_dups(topdirs, args['--digest-alg'], args['--block-size']) dups = file_dups(topdirs, args['--digest-alg'], args['--block-size'])
spam = dict(dups) spam = dict(dups)