aboutsummaryrefslogtreecommitdiff
path: root/src/app.ts
blob: 5edccbe352005b0ffb86d153db42aa3f805b9dfd (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
import { Countries } from "./countries.ts";
import { Cache } from "./util/cache.ts";
import { help } from "./util/help.ts";

export async function app() {
  const command = Deno.args[0];
  const countries = new Countries(new Cache());

  await countries.sync();
  switch (command) {
    case "sync":
      await countries.sync({ force: true });
      break;
    case "random":
      countries.print(countries.random());
      break;
    case "help":
      help();
      break;
    default:
      countries.print(Deno.args.join(" "));
      break;
  }
}