49 lines
997 B
TypeScript
49 lines
997 B
TypeScript
#!/usr/bin/env bun
|
|
|
|
import { program } from "commander";
|
|
import schema from "./schema";
|
|
import typedef from "./typedef";
|
|
import backup from "./backup";
|
|
import restore from "./restore";
|
|
import exportCmd from "./export";
|
|
import importCmd from "./import";
|
|
import admin from "./admin";
|
|
import init from "../functions/init";
|
|
|
|
init();
|
|
|
|
/**
|
|
* # Describe Program
|
|
*/
|
|
program
|
|
.name(`bun-mariadb`)
|
|
.description(`MariaDB manager for Bun`)
|
|
.version(`1.0.0`);
|
|
|
|
/**
|
|
* # Declare Commands
|
|
*/
|
|
program.addCommand(schema());
|
|
program.addCommand(typedef());
|
|
program.addCommand(backup());
|
|
program.addCommand(restore());
|
|
program.addCommand(exportCmd());
|
|
program.addCommand(importCmd());
|
|
program.addCommand(admin());
|
|
|
|
/**
|
|
* # Handle Unavailable Commands
|
|
*/
|
|
program.on("command:*", () => {
|
|
console.error(
|
|
"Invalid command: %s\nSee --help for a list of available commands.",
|
|
program.args.join(" "),
|
|
);
|
|
process.exit(1);
|
|
});
|
|
|
|
/**
|
|
* # Parse Arguments
|
|
*/
|
|
program.parse(Bun.argv);
|