auron
Version:
Interact with your ATProto labeler from your terminal
39 lines (31 loc) • 1.03 kB
text/typescript
import { program } from "commander";
import * as dotenv from "dotenv";
import fs from "fs";
import { queueCommand } from "./commands/queue";
import { dbCommand } from "./commands/db";
// import { exportCommand } from './commands/export';
// Function to load environment variables from a specified .env file
const loadEnvFile = (envFile: string) => {
if (fs.existsSync(envFile)) {
dotenv.config({ path: envFile });
} else {
console.error(`Environment file ${envFile} not found`);
process.exit(1);
}
};
// Add an option to specify the .env file
program
.option("-e, --env <path>", "specify .env file", ".env")
.hook("preAction", (thisCommand) => {
const envFile = thisCommand.opts().env;
loadEnvFile(envFile);
});
program
.name("auron")
.description("CLI tool to communicate with Ozone and ATProtocol services.")
.version("1.0.0");
program.addCommand(queueCommand);
program.addCommand(dbCommand);
// program.addCommand(exportCommand);
program.parse(process.argv);