Yargs: Has `yargs.positional` been removed?

Created on 19 Oct 2017  路  5Comments  路  Source: yargs/yargs

It's still in the docs, but when I use it in my code, I get:

TypeError: yargs.positional is not a function

What's going on here? Has it been removed? If so, what's the alternative?

Most helpful comment

@alexreg this feature hasn't yet been released, but the docs landed on master yesterday. To try out the new feature (I'd love feedback) run:

npm i yargs@next

All 5 comments

@alexreg this feature hasn't yet been released, but the docs landed on master yesterday. To try out the new feature (I'd love feedback) run:

npm i yargs@next

Oh right, I see. Thanks! It looks like a good idea from what I read in the docs. I think it would be best not to have any logic done based on the command string, in fact (simply use it as a dumb usage string).

@alexreg we've been using the command string DSL for a few major releases of yargs now, so probably going to stick with it for the time being. If you want to override this with an arbitrary usage string, you can use yargs.usage('foobar') in the same builder function that you use to define the.positional() arguments 馃憤

Yeah, I'm just generally against DSLs wherever possible, especially when JavaScript has the virtue of being such a great DSL of its own! But fair point. Thanks for the tips. :-)

Oh, only other thing I would suggest: maybe you could add the positional function to the top-level yargs. That would be very handy.

Was this page helpful?
0 / 5 - 0 ratings