mirror of
https://github.com/ION606/ion-cli.git
synced 2026-05-14 22:16:56 +00:00
20 lines
469 B
JavaScript
20 lines
469 B
JavaScript
|
|
/**
|
|
* @returns { Promise<JSON>>}
|
|
*/
|
|
export function getAndParse() {
|
|
return new Promise((resolve) => {
|
|
const argsRaw = [...process.argv].slice(2);
|
|
const args = {};
|
|
const keys = argsRaw.join(" ").split("--");
|
|
for (const i of keys) {
|
|
if (i.length == 0) continue;
|
|
|
|
const splitContent = i.split(" ");
|
|
args[splitContent[0]] = splitContent.slice(1);
|
|
}
|
|
|
|
return resolve(args);
|
|
});
|
|
}
|