add option to ingore unknown cmd line opts; bump version

This commit is contained in:
Tobias Oberstein 2014-07-26 17:20:47 +02:00
parent 43ee078ee6
commit 26a360a00c
2 changed files with 7 additions and 6 deletions

View file

@ -5,6 +5,7 @@
#
# Copyright 2010 Jeff Schiller
# Copyright 2010 Louis Simard
# Copyright 2013-2014 Tavendo GmbH
#
# This file is part of Scour, http://www.codedread.com/scour/
#
@ -70,7 +71,7 @@ except ImportError:
pass
APP = 'scour'
VER = '0.28'
VER = '0.29'
COPYRIGHT = 'Copyright Jeff Schiller, Louis Simard, 2010'
NS = { 'SVG': 'http://www.w3.org/2000/svg',
@ -3177,10 +3178,10 @@ def maybe_gziped_file(filename, mode="r"):
def parse_args(args=None):
def parse_args(args=None, ignore_additional_args=False):
options, rargs = _options_parser.parse_args(args)
if rargs:
if rargs and not ignore_additional_args:
_options_parser.error("Additional arguments not handled: %r, see --help" % rargs)
if options.digits < 0:
_options_parser.error("Can't have negative significant digits, see --help")
@ -3227,7 +3228,7 @@ def generateDefaultOptions():
def __init__(self, **entries):
self.__dict__.update(entries)
d = parse_args()[0].__dict__.copy()
d = parse_args(ignore_additional_args = True)[0].__dict__.copy()
return Struct(**d)