RoadSign/cli/index.ts

42 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-10-02 17:38:27 +00:00
import { Builtins, Cli } from "clipanion"
import figlet from "figlet"
import chalk from "chalk"
import { LoginCommand } from "./src/cmd/login.ts"
import { LogoutCommand } from "./src/cmd/logout.ts"
import { ListServerCommand } from "./src/cmd/list.ts"
import { StatusCommand } from "./src/cmd/status.ts"
import { InfoCommand } from "./src/cmd/info.ts"
import { ProcessCommand } from "./src/cmd/process-info.ts"
2024-10-02 15:12:52 +00:00
import { DeployCommand } from "./src/cmd/deploy.ts"
2024-10-02 17:38:27 +00:00
import { SyncCommand } from "./src/cmd/sync.ts"
import { ReloadCommand } from "./src/cmd/reload.ts"
const [node, app, ...args] = process.argv
const ENABLE_STARTUP_ASCII_ART = false
if (process.env["ENABLE_STARTUP_ASCII_ART"] || ENABLE_STARTUP_ASCII_ART) {
console.log(
chalk.yellow(figlet.textSync("RoadSign CLI", { horizontalLayout: "default", verticalLayout: "default" }))
)
}
const cli = new Cli({
binaryLabel: `RoadSign CLI`,
binaryName: `${node} ${app}`,
binaryVersion: `1.0.0`
})
2024-10-02 17:38:27 +00:00
cli.register(Builtins.VersionCommand)
cli.register(Builtins.HelpCommand)
cli.register(LoginCommand)
cli.register(LogoutCommand)
cli.register(ListServerCommand)
cli.register(StatusCommand)
cli.register(InfoCommand)
cli.register(ProcessCommand)
2024-10-02 15:12:52 +00:00
cli.register(DeployCommand)
2024-10-02 17:38:27 +00:00
cli.register(SyncCommand)
cli.register(ReloadCommand)
cli.runExit(args)