summaryrefslogtreecommitdiff
path: root/src/commands/check.ts
blob: 7f92d7ffe6f79fde4decea65aee577a8770e457e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import type { Command } from "commander";
import { checkDependencies } from "../actions/checkDependencies.js";
import { outputSummary } from "../actions/output.js";
import { sendAuditEmail } from "../actions/sendEmail.js";

export const check = (program: Command) => {
  program
    .command("check")
    .description("Checks given repos for security updates and logs output.")
    .option("-e, --email", "Send Email Report via the configured Email.")
    .action(async (options) => {
      const data = await checkDependencies();
      if (options.email) {
        sendAuditEmail(data);
      } else {
        outputSummary(data);
      }
    });
};