fart-it
fart-it copied to clipboard
Issue with "//" in replacement string
Steps to reproduce:
fart script.js "if (DEBUG" "//if (DEBUG"
My workaround for now (adding space before "//"), but hope it can be fixed:
fart script.js "if (DEBUG" " //if (DEBUG"
I think you have to escape a forward slash with a backslash.
For example \/\/if (DEBUG
@lionello This does not work. If you escape a slash with a backslash in the replace_string
, then the backslash is inserted as well.
If you don't escape a backslash in the replace_string
, then the help text pops up.
Because on Windows /
can be used for the short command line options, you have to use --
if you want to use /
as the prefix for the search or replace string:
fart script.js "if (DEBUG" -- "//if (DEBUG"
or
fart script.js -- "if (DEBUG" "//if (DEBUG"
- Thanks for explaining this! While I see
[--]
in the help after[options]
, it isn't explained anywhere, nor is it explained as you do above (apparently the position of it matters, too). As such, I reckon it would be vital that this is properly explained. - Secondly, I don't see why
--
should still be used if the search and/or replace string is already placed between double quotes.
The command interpreter removes the double quotes so the application doesn’t know there were quotes around it. I’ll add a note about the — to the help. Good idea.