Skip to content

Commit 0fd315f

Browse files
committed
Merge branch 'wildcard-options'
Make --exclude and --include options accept multiple arguments at once. Patch by Fabian Wermelinger (a.k.a. fab4100).
2 parents cbb00e9 + 13231c4 commit 0fd315f

File tree

3 files changed

+35
-9
lines changed

3 files changed

+35
-9
lines changed

docs/uncov-gcov.1

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" Automatically generated by Pandoc 1.17.0.3
22
.\"
3-
.TH "uncov-gcov" "1" "May 29, 2021" "uncov v0.3" ""
3+
.TH "uncov-gcov" "1" "June 05, 2021" "uncov v0.3" ""
44
.hy
55
.SH NAME
66
.PP
@@ -48,10 +48,23 @@ source files.
4848
Directory to look gcov files in.
4949
.SS \f[B]\-e\f[], \f[B]\-\-exclude\f[] [=""]
5050
.PP
51-
Set exclude file or directory.
51+
List of paths to exclude.
52+
Can be specifieid multiple times.
53+
.PP
54+
Examples:
55+
.IP
56+
.nf
57+
\f[C]
58+
uncov\-gcov\ \-\-exclude\ build\-release\ \-\-exclude\ build\-debug\ ...
59+
uncov\-gcov\ \-\-exclude\ build\-release\ build\-debug\ ...
60+
uncov\-gcov\ \-\-exclude\ build*\ ...
61+
\f[]
62+
.fi
5263
.SS \f[B]\-i\f[], \f[B]\-\-include\f[] [=""]
5364
.PP
54-
Set include file or directory.
65+
List of paths to include.
66+
Can be specifieid multiple times.
67+
See \f[B]\-\-exclude\f[] for examples.
5568
.SS \f[B]\-E\f[], \f[B]\-\-exclude\-pattern\f[] [=""]
5669
.PP
5770
Set exclude file/directory pattern.

docs/uncov-gcov/03-options.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,19 @@ Directory to look gcov files in.
5353
**-e**, **--exclude** [=""]
5454
---------------------------
5555

56-
Set exclude file or directory.
56+
List of paths to exclude. Can be specifieid multiple times.
57+
58+
Examples:
59+
60+
uncov-gcov --exclude build-release --exclude build-debug ...
61+
uncov-gcov --exclude build-release build-debug ...
62+
uncov-gcov --exclude build* ...
5763

5864
**-i**, **--include** [=""]
5965
---------------------------
6066

61-
Set include file or directory.
67+
List of paths to include. Can be specifieid multiple times. See **--exclude**
68+
for examples.
6269

6370
**-E**, **--exclude-pattern** [=""]
6471
-----------------------------------

uncov-gcov

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,12 @@ def create_args(params):
7676
parser.add_argument('--collect-root', metavar='DIR', default='',
7777
help='directory to look gcov files in '
7878
'(--root by default)')
79-
parser.add_argument('-e', '--exclude', metavar='DIR|FILE', action='append',
80-
help='set exclude file or directory', default=[])
81-
parser.add_argument('-i', '--include', metavar='DIR|FILE', action='append',
82-
help='set include file or directory', default=[])
79+
parser.add_argument('-e', '--exclude', metavar='DIR|FILE',
80+
nargs='+', action='append', default=[[]],
81+
help='set exclude file or directory')
82+
parser.add_argument('-i', '--include', metavar='DIR|FILE',
83+
nargs='+', action='append', default=[[]],
84+
help='set include file or directory')
8385
parser.add_argument('-E', '--exclude-pattern', dest='regexp',
8486
action='append', metavar='REGEXP', default=[],
8587
help='set exclude file/directory pattern')
@@ -538,6 +540,10 @@ def run():
538540
print('uncov-gcov v0.3')
539541
exit(0)
540542

543+
# flatten lists
544+
args.exclude = [e for items in args.exclude for e in items]
545+
args.include = [i for items in args.include for i in items]
546+
541547
if args.verbose:
542548
print('encodings: {}'.format(args.encodings))
543549

0 commit comments

Comments
 (0)