tohagan / cli-config

NodeJS API to assist command line apps reading and merging config objects from: defaults.json, ./<app>.json, process.argv, custom config
Other
6 stars 1 forks source link

Require minimist explicitly #8

Open TheBrockEllis opened 10 years ago

TheBrockEllis commented 10 years ago

Require the [cli] option to be explicitly stated before requiring the minimist package.

This will allow cli-config to serve in larger projects as a user configuration management tool and work in conjunction with other tools for parsing command line arguments.

tohagan commented 10 years ago

In it's current for this would force apps to include two command line parsers (minmist + your own).

So I'm wondering itfwe might be wiser to create two libs .. a new one that performs everything that cli-config does except that you pass in a command line parser function and then update cli-config to use it. Then cli-config can still include minimist as a dependency and sends it as the parser and remain backward compatible in terms of dependencies. You can then use the new lib to replace minimist and not have to load it as a dependency.

I'm a bit time stressed at the moment but hopefully will get some time next week for this.

tohagan commented 10 years ago

Sorry it's taken me a while to repond

tohagan commented 10 years ago

This is basically the same pattern we used for parsing config files in that you can replace the default JSON parser with a different parser like YAML. So it makes sense to offer the same pattern for the command line parser as well.