(s)
| 698 | // where will need to put the string in quotes as a precaution. This is more a printing |
| 699 | // aid rather an using for an API |
| 700 | export function quoteShellAndCmdChars(s): string { |
| 701 | const quote = /[\s\"\*\[\]!@#$%^&*\(\)\\:]/g.test(s) ? '"' : ''; |
| 702 | s = s.replace(/"/g, '\\"').replace(/\\/g, '\\\\'); |
| 703 | return quote + s.replace(/"/g, '\\"') + quote; |
| 704 | } |
| 705 | |
| 706 | export function quoteShellCmdLine(list: string[]): string { |
| 707 | return list.map((s) => quoteShellAndCmdChars(s)).join(' '); |