serenity
serenity copied to clipboard
`Args`: Allow escaping quotation marks in quoted context
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).
arg1arg with \quoted\"part."arg3
I propose to enable developers to parse them as follows instead.
arg1arg with "quoted" part.arg3