minimistjs / minimist

parse argument options
MIT License
551 stars 30 forks source link

Option to disable dotted notation #70

Open git-developer opened 5 months ago

git-developer commented 5 months ago

Minimist supports a dotted notation that may be used to build an object tree from args:

$ node index.js --foo.bar=x
{ _: [], foo: { bar: 'x' } }

This issue is a request to allow a user to disable this feature, so that the above example is parsed as foo.bar: 'x' instead of foo: { bar: 'x' }.

Motivation: the dotted notation supports neither arrays nor keys containing a dot. That makes it hard to use minimist if any of these is used in the application.

Related: #67, #69

ljharb commented 5 months ago

Why would a key ever contain a dot?

git-developer commented 5 months ago

I just mentioned this for the sake of completeness. I don't know of any practical use case either.

git-developer commented 5 months ago

The actual use case is to leave args untouched so that they can be post-processed using a different library that is able to build both objects and arrays (originally mentioned here).

shadowspawn commented 5 months ago

Somewhat related Minimist issues:

And related yargs-parser configuration: