You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The original purpose of result.escapedCommand was to be able to copy and paste the command for debugging purpose.
However, we now use it for the verbose option. So it has a second purpose: being safe to print in a terminal.
Those two purposes are actually quite different:
The first requires quoting characters with special meaning in a given shell. For example $ in Unix shells. Since we don't know for sure which shell is being used, and since shells have very different escaping rules, there is no perfect way to achieve this. However, we can do a best effort.
The second requires escaping characters which have special meaning when printed in a terminal. That is: control characters. For example, ANSI color sequences (or sequences that move the cursor, clear the screen, etc.) should be represented using notations like \u, \x or \e.
Based on the above, our current logic is not perfect and could be improved.
The text was updated successfully, but these errors were encountered:
The original purpose of
result.escapedCommand
was to be able to copy and paste the command for debugging purpose.However, we now use it for the
verbose
option. So it has a second purpose: being safe to print in a terminal.Those two purposes are actually quite different:
$
in Unix shells. Since we don't know for sure which shell is being used, and since shells have very different escaping rules, there is no perfect way to achieve this. However, we can do a best effort.\u
,\x
or\e
.Based on the above, our current logic is not perfect and could be improved.
The text was updated successfully, but these errors were encountered: