diff options
| -rw-r--r-- | main.ts | 21 | ||||
| -rw-r--r-- | src/app.ts | 22 | ||||
| -rw-r--r-- | src/countries.ts (renamed from countries.ts) | 0 | ||||
| -rw-r--r-- | src/environment/environment.ts (renamed from environment/environment.ts) | 0 | ||||
| -rw-r--r-- | src/models/country.model.ts (renamed from models/country.model.ts) | 1 | ||||
| -rw-r--r-- | src/util/cache.ts (renamed from util/cache.ts) | 0 |
6 files changed, 25 insertions, 19 deletions
@@ -1,20 +1,3 @@ -import { Countries } from "./countries.ts"; -import { Cache } from "./util/cache.ts"; +import { app } from "./src/app.ts"; -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]); -} +await app(); 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]); + } +} diff --git a/countries.ts b/src/countries.ts index 895a93f..895a93f 100644 --- a/countries.ts +++ b/src/countries.ts diff --git a/environment/environment.ts b/src/environment/environment.ts index 0e29225..0e29225 100644 --- a/environment/environment.ts +++ b/src/environment/environment.ts diff --git a/models/country.model.ts b/src/models/country.model.ts index 53e68c5..4765d5e 100644 --- a/models/country.model.ts +++ b/src/models/country.model.ts @@ -1,5 +1,6 @@ // For better currency types, this can be used later: // https://github.com/freeall/currency-codes +// Same can be done for language abbreviations export type CurrencyAbbr = string; export type CurrencyInfo = { name: string; symbol: string }; export type LangAbbr = string; diff --git a/util/cache.ts b/src/util/cache.ts index 3a0c5d4..3a0c5d4 100644 --- a/util/cache.ts +++ b/src/util/cache.ts |
