mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-27 08:21:03 +02:00
17 lines
390 B
TypeScript
17 lines
390 B
TypeScript
const quotePath = (path: string) => {
|
|
if (!path) return '';
|
|
if (path.indexOf('"') < 0 && path.indexOf(' ') < 0) return path;
|
|
path = path.replace(/"/, '\\"');
|
|
return `"${path}"`;
|
|
};
|
|
|
|
export default (commandName: string, args: string[] = []) => {
|
|
const output = [quotePath(commandName)];
|
|
|
|
for (const arg of args) {
|
|
output.push(quotePath(arg));
|
|
}
|
|
|
|
return output.join(' ').trim();
|
|
};
|