Astyle: problems excluding files and directories using the "-exclude" option

I recently ran into an issue of using astil that I could not figure out. I'm not sure if this is a bug, or if I'm just using the astil tool incorrectly. I'm trying to use the "-exclude" option to omit files and directories from processing, but keep getting an "unmatched" exception error and the astyle exits:

bwallace$ ls -l foo.c
-rw-r--r-- 1 bwallace 1767304860 22 Aug 1 21:36 foo.c

bwallace$ astyle ./foo.c --exclude=./foo.c -v
Artistic Style 2.04 08/03/2014
Exclude (unmatched) ./foo.c
Artistic Style has terminated

      

When I pass "-i" (ignore exception errors), astil processes the file as expected. Hence, this is a problem with the exclude operator.

bwallace$ astyle ./foo.c --exclude=./foo.c -v -i
Artistic Style 2.04 08/03/2014
Exclude (unmatched) ./foo.c
Unchanged ./foo.c
0 formatted 1 unchanged 0.00 seconds 2 lines

      

This is mistake? Am I using astil incorrectly? Any help would be appreciated.

+3


source to share


1 answer


Directory exclusion is done using a simple string containing the match rather than matching the actual directories. I had the same problem and figured it out by looking at the source here .

Adding a lot of options is a bit tedious. I found it easier to create an options file. Astil's website has instructions on where to put it.



To exclude multiple files or directories, you need to have several "-exclude" options in the file:

--exclude=dir/subdir1
--exclude=dir/subdir2

      

+1


source







All Articles