aboutsummaryrefslogtreecommitdiff
path: root/src/app.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.ts')
-rw-r--r--src/app.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/app.ts b/src/app.ts
new file mode 100644
index 0000000..87aa8bb
--- /dev/null
+++ b/src/app.ts
@@ -0,0 +1,22 @@
+import { Countries } from "./countries.ts";
+import { Cache } from "./util/cache.ts";
+
+export async function app() {
+ const countries = new Countries(new Cache());
+
+ await countries.sync();
+
+ const arg = Deno.args[0];
+
+ if (arg === "sync") {
+ await countries.sync({ force: true });
+ }
+
+ if (arg === "random") {
+ countries.print(countries.random());
+ }
+
+ if (arg === "find") {
+ countries.print(Deno.args[1]);
+ }
+}