export function getCliOutput()

in packages/sqrl-cli/src/cli/CliMain.ts [68:98]


export function getCliOutput(
  args: CliArgs,
  stdout: Writable = process.stdout
): CliOutput {
  const outputOptions: CliOutputOptions = {
    stdout,
    features: args.features,
    onlyBlocked: args.onlyBlocked,
  };
  if (args.output === "pretty") {
    if (args.command === "compile") {
      return new CliSlotJsOutput(stdout);
    } else {
      return new CliPrettyOutput(outputOptions);
    }
  } else if (args.output === "csv") {
    return new CliCsvOutput(outputOptions);
  } else if (args.output === "table") {
    return new CliTableOutput(outputOptions);
  } else if (args.output === "json") {
    return new CliJsonOutput(outputOptions);
  } else if (args.output === "expr") {
    return new CliExprOutput(stdout);
  } else if (args.output === "dot") {
    return new CliDotOutput(stdout);
  } else if (args.output === "slot-js") {
    return new CliSlotJsOutput(stdout);
  } else {
    throw new CliError("Unknown output type: " + args.output);
  }
}