1234567891011121314151617181920212223242526272829303132333435363738394041 |
- export { parseArgsStringToArgv };
- export default function parseArgsStringToArgv(value, env, file) {
-
-
-
-
- var myRegexp = /([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*)|[^\s'"]+|(['"])([^\5]*?)\5/gi;
- var myString = value;
- var myArray = [];
- if (env) {
- myArray.push(env);
- }
- if (file) {
- myArray.push(file);
- }
- var match;
- do {
-
- match = myRegexp.exec(myString);
- if (match !== null) {
-
-
- myArray.push(firstString(match[1], match[6], match[0]));
- }
- } while (match !== null);
- return myArray;
- }
- function firstString() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- for (var i = 0; i < args.length; i++) {
- var arg = args[i];
- if (typeof arg === "string") {
- return arg;
- }
- }
- }
|