-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use parsing position (integer) as argument #40
Comments
From looking into the code Lines 355 to 371 in a47fa77
you can use the following:
Which is also part of the JsDoc comment for that method. But it could of course be added to the longer example (Or even |
Slice is not working. can anyone confirm this? const res = parse({
argv: ["--a=a", "--b=b", "--c=c"],
// the dashdash parser is designed for cli use, the argv takes [0] path [1] file [2...] as args.
slice: 0,
options: [
{ name: "a", type: "string" },
{ name: "b", type: "string" },
{ name: "c", type: "string" },
],
});
console.log(res); output. Object {
"_args": Array [],
"_order": Array [
Object {
"from": "argv",
"key": "c",
"value": "c",
},
],
"c": "c",
} |
dashdash might already have this feature.
normally process.argv looks like:
['node','index.js','--foo','--bar','--baz']
but what if I have an array like so representing process.argv?
['--foo','--bar','--baz']
how can I tell dashdash to start parsing from position 0?
thanks
The text was updated successfully, but these errors were encountered: