aboutsummaryrefslogtreecommitdiff
path: root/src/app.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.ts')
-rw-r--r--src/app.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/app.ts b/src/app.ts
index 09db256..10129e1 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -1,3 +1,4 @@
+import { green, cyan } from "https://deno.land/x/[email protected]/mod.ts";
import { Countries } from "./countries.ts";
import { Cache } from "./util/cache.ts";
import { help } from "./util/help.ts";
@@ -11,14 +12,22 @@ export async function app() {
case undefined:
help();
break;
+ case "help":
+ help();
+ break;
case "sync":
await countries.sync({ force: true });
break;
case "random":
countries.print(countries.random());
break;
- case "help":
- help();
+ case "capital":
+ const [, ...args] = Deno.args;
+ const capital = args.join(" ");
+ const country = countries.findByCapital(capital);
+ console.log(
+ green(capital) + " is the capital of " + cyan(country.name.common)
+ );
break;
default:
countries.print(Deno.args.join(" "));