@trenskow/arguments-parser 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +3 -3
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import caseit from '@trenskow/caseit';
|
|
|
12
12
|
import { default as isvalid, keyPaths, formalize } from 'isvalid';
|
|
13
13
|
import print from '@trenskow/print';
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const argumentsParser = ({ args = process.argv.slice(2), argvLevel = 0, placeholder = '<>' } = {}) => {
|
|
16
16
|
|
|
17
17
|
const [ opening, closing ] = placeholder.split('');
|
|
18
18
|
|
|
@@ -78,7 +78,7 @@ const argumentParser = ({ args = process.argv.slice(2), argvLevel = 0, placehold
|
|
|
78
78
|
args = args.slice(1);
|
|
79
79
|
argvLevel++;
|
|
80
80
|
|
|
81
|
-
return await commands[tool]({ args,
|
|
81
|
+
return await commands[tool]({ args, argumentsParser: argumentsParser({ args, argvLevel, placeholder }) });
|
|
82
82
|
|
|
83
83
|
} catch (error) {
|
|
84
84
|
print.err(`${error.stack}`);
|
|
@@ -233,4 +233,4 @@ const argumentParser = ({ args = process.argv.slice(2), argvLevel = 0, placehold
|
|
|
233
233
|
|
|
234
234
|
};
|
|
235
235
|
|
|
236
|
-
export default
|
|
236
|
+
export default argumentsParser;
|