mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-12-17 08:54:19 +08:00
generateCode作为模块代码
This commit is contained in:
21
src/js/composer/generateCode.js
Normal file
21
src/js/composer/generateCode.js
Normal file
@@ -0,0 +1,21 @@
|
||||
export function generateCode(commandFlow) {
|
||||
let code = [];
|
||||
|
||||
commandFlow.forEach((cmd) => {
|
||||
let line = "";
|
||||
|
||||
if (cmd.outputVariable) {
|
||||
line += `let ${cmd.outputVariable} = `;
|
||||
}
|
||||
|
||||
if (cmd.value === "ubrowser") {
|
||||
line += cmd.argv;
|
||||
} else {
|
||||
line += `${cmd.value}(${cmd.argv})`;
|
||||
}
|
||||
|
||||
code.push(line);
|
||||
});
|
||||
|
||||
return code.join("\n");
|
||||
}
|
||||
Reference in New Issue
Block a user