summaryrefslogtreecommitdiff
path: root/apps/installer/main.ts
blob: 135ccc64521d5e10b465cd322944ae1b208563d1 (plain)
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
42
43
import { Command } from "https://cdn.deno.land/cmd/versions/v1.2.0/raw/mod.ts";
import { getAcoreReleaseVersion } from "./utils.ts";
import { Input } from "https://deno.land/x/cliffy@v0.25.2/prompt/mod.ts";

const program = new Command();

program
  .name("acore.sh")
  .description("Shell scripts for docker")
  .version("1.0.0");

// program
//   .command("quit")
//   .description("Close docker command")
//   .action(() => {
//     process.exit(0);
//   });

program
  .command("version")
  .description("Get the version of the current AzerothCore revision")
  .action(async () => {
    console.log(await getAcoreReleaseVersion());
  });

async function main() {
  let exit = false;
  do {
    if (Deno.args.length === 0) {
      program.outputHelp();
      const command = await Input.prompt({
        message: "Enter the command:",
      });
      console.log(command);
      await program.parseAsync(command.split(" "));
    } else {
      exit = true;
      await program.parseAsync(Deno.args);
      process.exit(0);
    }
  } while (!exit);
}
main();