All files / src/commands RunCommand.ts

92.86% Statements 13/14
68.75% Branches 11/16
50% Functions 1/2
100% Lines 13/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1924x     24x 24x 24x 2x 2x 2x 2x 2x     2x 2x 2x 2x    
import { argdown, IFileRequest, ILogParserErrorsRequest } from "@argdown/node";
import { Arguments } from "yargs";
 
export const command = "run [process]";
export const desc = "run a process you have defined in your config file";
export const handler = async (argv: Arguments) => {
  const processName = argv.process || "default";
  let config = <IFileRequest & ILogParserErrorsRequest>await argdown.loadConfig(argv.config);
  Eif (!config.process || processName !== "default") {
    Eif (config.processes && config.processes[processName]) {
      config.process = config.processes[processName];
    }
  }
  config.logLevel = argv.verbose ? "verbose" : config.logLevel;
  config.watch = argv.watch || config.watch;
  config.logParserErrors = argv.logParserErrors || config.logParserErrors;
  await argdown.load(config).catch(e => console.log(e));
};