summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/index.js b/index.js
index 53daae4..b02aedb 100644
--- a/index.js
+++ b/index.js
@@ -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()}`);