-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
36 lines (34 loc) · 1.24 KB
/
main.js
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
import { Command } from "./src/deps.js";
import describe from "./src/commands/describe.js";
import connections from "./src/commands/connections.js";
import addConnection from "./src/commands/add-connection.js";
import removeConnection from "./src/commands/rm-connection.js";
import getConnection from "./src/commands/get-connection.js";
import getConnectionTypes from "./src/commands/get-connection-types.js";
import query from "./src/commands/query.js";
import { VERSION } from "./src/version.js";
import logger from "./src/logger.js";
logger.debug("Debug mode enabled");
try {
await new Command()
.name("sqlr")
.version(VERSION)
.description(
"Command line for interacting with SQL databases. Use '--help' for each command to list it's parameters",
)
.action(function () {
this.showHelp();
})
.globalOption("--debug", "Enable debug logs")
.command("add-connection", addConnection)
.command("rm-connection", removeConnection)
.command("get-connection", getConnection)
.command("get-connection-types", getConnectionTypes)
.command("connections", connections)
.command("describe", describe)
.command("query", query)
.parse();
} catch (err) {
logger.error(err.message);
logger.debug(err);
}