DenReg/cli/commands/run.ts
User user e5829d9a4f
All checks were successful
continuous-integration/drone/push Build is passing
Add script running abilities
2021-04-28 11:47:52 +02:00

19 lines
626 B
TypeScript

import { Colors, Path, FS, Compress, Base64 } from "../deps.ts";
import { getMeta, IMeta, log, getConfig } from "../global.ts";
import { ServerError } from "../helper/server_error.ts";
import { runScript } from "../helper/run_script.ts";
export default async function run(options: {}, name: string) {
const { scripts } = await getMeta();
if (!scripts || !scripts[name]) {
console.log(Colors.bold(Colors.red("Script not found:")), name);
} else {
let script = scripts[name];
if (!Array.isArray(script)) script = [script];
for (const s of script) {
await runScript(s);
}
}
}