You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
Tools: Moved some utility functions to @joplin/utils to reduce dependencies between packages
This commit is contained in:
16
packages/utils/commandToString.ts
Normal file
16
packages/utils/commandToString.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
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(' ');
|
||||
};
|
||||
Reference in New Issue
Block a user