Skip to content

Commit 2b2b425

Browse files
committed
igor.script: Replace ArgumentParser(version=...) with a version argument
ArgumentParser lost its undocumented version argument in 3.3.0 [1,2,3]. The version action is the documented way to do this [4]. [1]: http://bugs.python.org/issue13248 [2]: https://hg.python.org/cpython/rev/5393382c1b1d [3]: https://hg.python.org/cpython/file/374f501f4567/Misc/HISTORY#l477 [4]: https://docs.python.org/3/library/argparse.html#action
1 parent 2c2a79d commit 2b2b425

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

igor/script.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ class Script (object):
3636
log_levels = [_logging.ERROR, _logging.WARNING, _logging.INFO, _logging.DEBUG]
3737

3838
def __init__(self, description=None, filetype='IGOR Binary Wave (.ibw) file'):
39-
self.parser = _argparse.ArgumentParser(
40-
description=description, version=__version__)
39+
self.parser = _argparse.ArgumentParser(description=description)
40+
self.parser.add_argument(
41+
'--version', action='version',
42+
version='%(prog)s {}'.format(__version__))
4143
self.parser.add_argument(
4244
'-f', '--infile', metavar='FILE', default='-',
4345
help='input {}'.format(filetype))

0 commit comments

Comments
 (0)