diff --git a/src/node/types/CliArgv.ts b/src/node/types/CliArgv.ts new file mode 100644 index 000000000..1c7f373b8 --- /dev/null +++ b/src/node/types/CliArgv.ts @@ -0,0 +1,6 @@ +export type CliArgv = { + settings?: string; + credentials?: string; + sessionkey?: string; + apikey?: string; +} diff --git a/src/node/types/PadDiffLineOps.ts b/src/node/types/PadDiffLineOps.ts new file mode 100644 index 000000000..9b1c4eb5d --- /dev/null +++ b/src/node/types/PadDiffLineOps.ts @@ -0,0 +1,5 @@ +export type PadDiffLineOps = { + next: ()=>PadDiffLineOps, + done: boolean, + value: PadDiffLineOps +} diff --git a/src/node/types/PadRevision.ts b/src/node/types/PadRevision.ts new file mode 100644 index 000000000..800d89bfd --- /dev/null +++ b/src/node/types/PadRevision.ts @@ -0,0 +1,6 @@ +export type PadRevision = { + changeset: string + meta:{ + author: string + } +} diff --git a/src/node/utils/Cli.js b/src/node/utils/Cli.ts similarity index 80% rename from src/node/utils/Cli.js rename to src/node/utils/Cli.ts index 1579dd3ce..dc63ecad7 100644 --- a/src/node/utils/Cli.js +++ b/src/node/utils/Cli.ts @@ -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;