Remove extend action
This commit is contained in:
parent
8c13f457cc
commit
3599e9d81c
1 changed files with 5 additions and 10 deletions
15
pass2csv
15
pass2csv
|
@ -136,13 +136,6 @@ def main(store_path, grouping_base, outfile, gpgbinary, use_agent, encodings,
|
||||||
|
|
||||||
|
|
||||||
def parse_args(args):
|
def parse_args(args):
|
||||||
class ExtendAction(argparse.Action):
|
|
||||||
# Python 3.8 has 'extend' built in.
|
|
||||||
def __call__(self, parser, namespace, values, option_string=None):
|
|
||||||
items = getattr(namespace, self.dest) or []
|
|
||||||
items.extend(values)
|
|
||||||
setattr(namespace, self.dest, items)
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'store_path',
|
'store_path',
|
||||||
|
@ -199,11 +192,13 @@ def parse_args(args):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-e', '--exclude',
|
'-e', '--exclude',
|
||||||
metavar='pattern',
|
metavar='pattern',
|
||||||
action=ExtendAction,
|
action='append',
|
||||||
nargs='+',
|
|
||||||
type=str,
|
type=str,
|
||||||
default=[],
|
default=[],
|
||||||
help="regexps for lines which should not be exported",
|
help=(
|
||||||
|
"regexp for lines which should not be exported, can be specified"
|
||||||
|
" multiple times"
|
||||||
|
),
|
||||||
dest='exclude'
|
dest='exclude'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue