aboutsummaryrefslogtreecommitdiff
path: root/dev/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'dev/util.js')
-rw-r--r--dev/util.js68
1 files changed, 0 insertions, 68 deletions
diff --git a/dev/util.js b/dev/util.js
index 731b5456..ff1c0120 100644
--- a/dev/util.js
+++ b/dev/util.js
@@ -22,74 +22,6 @@ import path from 'path';
import {parseJson} from './json.js';
/**
- * @param {string[]} args
- * @param {Map<?string, (boolean|null|number|string|string[])>} argMap
- * @returns {Map<?string, (boolean|null|number|string|string[])>}
- */
-export function getArgs(args, argMap) {
- let key = null;
- let canKey = true;
- let onKey = false;
- for (const arg of args) {
- onKey = false;
-
- if (canKey && arg.startsWith('--')) {
- if (arg.length === 2) {
- canKey = false;
- key = null;
- onKey = false;
- } else {
- key = arg.substring(2);
- onKey = true;
- }
- }
-
- const target = argMap.get(key);
-
- switch (typeof target) {
- case 'boolean':
- argMap.set(key, true);
- key = null;
- break;
- case 'number':
- argMap.set(key, target + 1);
- key = null;
- break;
- case 'string':
- if (!onKey) {
- argMap.set(key, arg);
- key = null;
- }
- break;
- case 'object':
- if (target === null) {
- if (!onKey) {
- argMap.set(key, arg);
- key = null;
- }
- return argMap;
- } else if (Array.isArray(target)) {
- if (!onKey) {
- target.push(arg);
- key = null;
- }
- return argMap;
- } else {
- console.error(`Unknown argument: ${arg}`);
- key = null;
- }
- break;
- default:
- console.error(`Unknown argument: ${arg}`);
- key = null;
- break;
- }
- }
-
- return argMap;
-}
-
-/**
* @param {string} baseDirectory
* @param {?(fileName: string, isDirectory: boolean) => boolean} predicate
* @returns {string[]}