mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-08 16:05:05 -04:00
Translatetd cli to ts.
This commit is contained in:
parent
253186daf5
commit
26b120caec
4 changed files with 27 additions and 8 deletions
|
@ -21,33 +21,35 @@
|
|||
*/
|
||||
|
||||
// An object containing the parsed command-line options
|
||||
exports.argv = {};
|
||||
import type {CliArgv} from "../types/CliArgv";
|
||||
|
||||
const argv = process.argv.slice(2);
|
||||
export const argv:CliArgv = {};
|
||||
|
||||
const argvIn = process.argv.slice(2);
|
||||
let arg, prevArg;
|
||||
|
||||
// Loop through args
|
||||
for (let i = 0; i < argv.length; i++) {
|
||||
arg = argv[i];
|
||||
for (let i = 0; i < argvIn.length; i++) {
|
||||
arg = argvIn[i];
|
||||
|
||||
// Override location of settings.json file
|
||||
if (prevArg === '--settings' || prevArg === '-s') {
|
||||
exports.argv.settings = arg;
|
||||
argv.settings = arg;
|
||||
}
|
||||
|
||||
// Override location of credentials.json file
|
||||
if (prevArg === '--credentials') {
|
||||
exports.argv.credentials = arg;
|
||||
argv.credentials = arg;
|
||||
}
|
||||
|
||||
// Override location of settings.json file
|
||||
if (prevArg === '--sessionkey') {
|
||||
exports.argv.sessionkey = arg;
|
||||
argv.sessionkey = arg;
|
||||
}
|
||||
|
||||
// Override location of APIKEY.txt file
|
||||
if (prevArg === '--apikey') {
|
||||
exports.argv.apikey = arg;
|
||||
argv.apikey = arg;
|
||||
}
|
||||
|
||||
prevArg = arg;
|
Loading…
Add table
Add a link
Reference in a new issue