index.ts 498 Bytes
Newer Older
silver47gin's avatar
silver47gin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
import commander from "commander";
import fs from "fs";
import path from "path";

const program = commander.program;

(async function () {
  const commandsDirPath = path.join(__dirname, "command");
  const commandFileNames = fs.readdirSync(commandsDirPath);
  for (const commandFileName of commandFileNames) {
    const commandFileAbsolutePath = path.join(commandsDirPath, commandFileName);
    require(commandFileAbsolutePath).default(program);
  }
  await program.parseAsync(process.argv);
})();