A simple filter that finds occurrences of a string in a textfile of many lines. It is doing its thing line-by-line, so the whole file is not bloated into memory. Text formatting is assumed to be iso-8859-1
.
In a SLIME-repl do the following:
(asdf:load-asd #P"d:/Projects/line-parser/line-parser.asd") ;; or wherever the asd file is located
(ql:quickload "line-parser")
The method duplicate-free-warnings
can be used as an entry point directly. Pass it a string for the warning id and one for the path to the input file with all buildwarnings.
(duplicate-free-warnings "CA2016" "d:/buildwarnings/ca2016-secondfix")
The executable accepts the following commandline arguments
short name | long name | description |
---|---|---|
–help | display usage information and exit | |
–version | display version and exit | |
-d | –drop <VALUE> | The string after which the rest of the line is dropped. Ignored if nothing is specified. |
-i | –input <VALUE> | The path to the input file with the buildoutput. |
-o | –output <VALUE> | The output file to store the results in. |
-r | –raw-results | Save additional raw results, i.e., containing duplicates as well. |
-s | –silent | Run silent. Don’t print results to the standard output. |
-w | –warning <VALUE> | The warning key. (Some random string that gets filtered) |
w
is basically any string, so this will filter any line in any file, that contains the warning id string.
e.g.:
./line-parser -w CA2016 -i /path/to/inputfile -o /path/to/outputfile -d ")" -r
This will search for occurences of “CA2016” (w
tag) in the inputfile (i
tag) and drop all the findings cropped after the “)” character (d
tag) and without duplicates in the “outputfile” (o
tag). With the r
tag, the raw findings will be preserved in “outputfile-raw”.
In the directory of the Makefile, run
make
This will drop the executable in a the build
subfolder.
- Start
sbcl
from the command linesbcl
- Load the asdf-system
(asdf:load-asd #P"d:/Projects/line-parser/line-parser.asd") ;; or wherever the asd file is located
- Quickload it
(ql:quickload "line-parser")
- Use
asdf:make
or(sb-ext:save-lisp-and-die)
to make an executable(asdf:make :line-parser) ;; way easier via asdf... ;; (sb-ext:save-lisp-and-die #P"d:/Projects/line-parser/build/line-parser" :toplevel #'line-parser:main :executable t)
Run make test
in the directory of the Makefile.
Do the following
(asdf:load-asd #p"~/repos/line-parser/line-parser.asd")
(ql:quickload "line-parser/tests")
;; make sure the the current working direcotry is set to <PROJECT_ROOT>/tests
;; i.e. by pressing C-c-~ in SLIME
(run! 'lparser)