aboutsummaryrefslogtreecommitdiff
path: root/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'index.js')
-rw-r--r--index.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/index.js b/index.js
index 6fbed0f..258ad01 100644
--- a/index.js
+++ b/index.js
@@ -68,7 +68,6 @@ try {
}
}
}
-
let pargv = process.argv;
pargv[1] = "twi";
@@ -104,8 +103,13 @@ try {
console.log(c.yellow("warn:") + " process was stopped unexpectedly");
}
}
+
fs.writeFileSync(home + "/runtime.pid", process.pid.toString());
let command = argv._[0];
+ let aliases = require('./commands/aliases.json');
+ if ([].concat(Object.keys(aliases).map(i => aliases[i])).flat(1).includes(command)) {
+ command = Object.keys(aliases).map(i => { if (aliases[i].includes(command)) { return i; } else { return null; } }).filter(i => i !== null)[0];
+ }
await require('./commands/' + command)(argv);
fs.rmSync(home + "/runtime.pid");