Skip to content

Commit

Permalink
Allow specyfing a list of input files via a file (-l / --file-list)
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Eric Leblond <eric@regit.org>
  • Loading branch information
Thomas Graf authored and regit committed Oct 28, 2011
1 parent 5b63282 commit 61360f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions coccigrep
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ parser.add_argument('-f', '--output-format', dest='oformat', default=cocciinst.g
parser.add_argument('-v', '--verbose', action='store_const', const=True, help='verbose output (including coccinelle error)', default=cocciinst.getboolean('global', 'verbose'))
parser.add_argument('file', metavar='file', nargs='*', help='List of files', default=None)
parser.add_argument('-L', '--list-operations', const=True, dest='listop', action='store_const', help='List available operations', default=None)
parser.add_argument('-l', '--file-list', default=None, dest='file_list', help='File containing a list of files to search in')
parser.add_argument('--version', action='version', version='%(prog)s 1.4')

args = parser.parse_args()
Expand Down Expand Up @@ -96,6 +97,10 @@ if args.ncpus > 1:
if not coccigrep.set_concurrency(args.ncpus):
sys.stderr.write("Warning: Concurrency not available on this system.\n")

if args.file_list:
for line in open(args.file_list, 'r'):
args.file.append(line.rstrip())

try:
coccigrep.setup(args.type, args.attribut, args.operation)
coccigrep.run(args.file)
Expand Down
3 changes: 3 additions & 0 deletions coccigrep.1
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ Number of cpus to use.
.TP
.BI \-s " SP" "\fR,\fP \-\^\-sp=" SP
Semantic patch to use.
.TP
.BI \-l " FILE" "\fR,\fP \-\^\-file\-list=" FILE
File containing a list of input files.

.SH BUGS
The operation option could lead to some missed match because the semantic
Expand Down

0 comments on commit 61360f9

Please sign in to comment.