hello.ts 648 Bytes
Newer Older
silver47gin's avatar
silver47gin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
import { Command } from "commander";
import dayjs from "dayjs";
import { ConfigManager } from "../utils";

interface Config {
  runTime: number;
  times: number[];
}

export default (program: Command) => {
  program
    .command("hello")
    .description("命令行运行测试")
    .action(async function () {
      const config = await ConfigManager.create<Config>("hello", {
        runTime: 0,
        times: [],
      });
      await config.setValues({
        runTime: config.getValues().runTime + 1,
        times: [...config.getValues().times, dayjs().valueOf()],
      });

      console.log(config.getValues());
      return;
    });
};