serenity icon indicating copy to clipboard operation
serenity copied to clipboard

`Args`: Allow escaping quotation marks in quoted context

Open florian1345 opened this issue 2 years ago • 0 comments

Unless I am missing something, there is currently no way of providing the " character as part of a quoted argument to a command. In quoted context, it is always parsed as a delimiter. It would be nice to be able to escape quotation marks (e.g. \") in order for the Args struct to interpret them as literals. The example notation would require passing backslashes as \\. Therefore, I suggest making this optional.

As an example, consider the command invocation command arg1 "arg with \"quoted\" part." arg3. In the current framework, the arguments would be parsed as follows (in quoted mode).

  • arg1
  • arg with \
  • quoted\"
  • part."
  • arg3

I propose to enable developers to parse them as follows instead.

  • arg1
  • arg with "quoted" part.
  • arg3

florian1345 avatar Aug 10 '22 23:08 florian1345