mirror of
https://github.com/ION606/ion-cli.git
synced 2026-05-14 22:16:56 +00:00
initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
|
||||
/**
|
||||
* @returns { Promise<Array<String>>}
|
||||
*/
|
||||
export function getAndParse() {
|
||||
return new Promise((resolve) => {
|
||||
const argsRaw = [...process.argv].slice(2);
|
||||
const args = {};
|
||||
// const keys = {};
|
||||
// for (const i of argsRaw) {
|
||||
// if (i.indexOf('--') !== -1) {
|
||||
// keys[i.split('--')[1]] = argsRaw.indexOf(i)
|
||||
// }
|
||||
// }
|
||||
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);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user