diff options
-rw-r--r-- | index.js | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -12,11 +12,12 @@ const headers = { const flags = parse(Deno.args, { boolean: ["login", "logout"], - default: { login: true } + string: ["config"], + default: { login: true, config: "./credentials.json" } }); try { - const credentials = JSON.parse(await Deno.readTextFile("./credentials.json")); + const credentials = JSON.parse(await Deno.readTextFile(flags.config)); if (lodash.isEmpty(credentials.username) || lodash.isEmpty(credentials.password)) { throw "Invalid credentials! "; @@ -36,7 +37,7 @@ const headers = { if (err instanceof SyntaxError) { exitWithError("Parse json failed!"); } else if (err instanceof Deno.errors.NotFound) { - exitWithError("./credentials.json not found!") + exitWithError("credentials.json not found!") } else { console.error(`[ERROR]: ${err.toString()}`); |