-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.ts
41 lines (35 loc) · 1.33 KB
/
index.ts
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import process from "process";
import { Command } from "commander";
import install from "./src/commands/install";
import { dbBackup, dbList } from "./src/commands/database";
import general from "./src/commands/general";
const program = new Command();
program.version("1.0.0").description("BackupDBee CLI");
program
.command("install")
.alias("i")
.description("Check required commands, create backupdbee.yaml file")
.action(async () => await install());
program
.command("db:list")
.description("List all databases and show the total count")
.action(dbList);
program
.command("db:backup")
.description("Backup all databases or a specific one with --name flag")
.option("--name <dbName>", "Name of the database to backup")
.action((options: { name?: string }) => {
dbBackup(options);
});
program
.command("general")
.description("Configure general settings in backupdbee.yaml")
.option("--backup-location <location>", "Set the backup location")
.option("--log-location <location>", "Set the log location")
.option("--log-level <level>", "Set the log level (e.g., INFO, DEBUG)")
.option("--retention-policy <days>", "Set retention policy in days", parseInt)
.option("--backup-schedule <cron>", "Set backup schedule in cron format")
.action(async (options) => {
general(options);
});
program.parse(process.argv);