comby
comby copied to clipboard
Matching '--'
Hey, I'm trying to match Haskell line comments, which start with --
, but I'm getting the following error:
$ comby "-- " "--- " ./file
Error parsing command line. Run with -help for usage information.
unknown flag --
Is there a way around it?
Hey @GarkGarcia
It seems there is some trouble with escaping --
so that comby
doesn't think it is a flag. There isn't a way around this directly on the command line and I'll have to investigate.
The good news is that there's an overall workaround, but it is a little roundabout. You can create templates in files and the contents will be read from there and not parsed on the command line using the -templates
option. For your example:
mkdir templates
cd templates
touch match
# open the match file and enter the contents `-- `
touch rewrite
# open the rewrite file and enter the contents `--- `
cd ..
comby -templates templates -f ./file
Note that comby
will by default treat comments for a language like whitespace, so if you want to rewrite the actual comment, perhaps use comby -templates templates -f ./file -matcher .txt
.
Note that this problem is very specific to the --
pattern, anything else should not be a problem. Sorry about that! I'll come up with a fix soon, but there will be some delay to cut a release and so on, so the workaround above is the quickest way for now.