node-dashdash icon indicating copy to clipboard operation
node-dashdash copied to clipboard

Feature Request: add support for config files

Open konobi opened this issue 9 years ago • 2 comments

It'd be nice if there was support for config files like there is for environment variables. That'd make cmdln the only library I'd need to bootstrap a command line app.

konobi avatar Mar 01 '16 23:03 konobi

Can you elaborate? How would that look in dashdash? What configure file syntax would it specify? I'm slightly skeptical

--Trent

On Mar 1, 2016, at 3:40 PM, Scott McWhirter [email protected] wrote:

It'd be nice if there was support for config files like there is for environment variables. That'd make cmdln the only library I'd need to bootstrap a command line app.

— Reply to this email directly or view it on GitHub.

trentm avatar Mar 02 '16 00:03 trentm

Have a config object that's pre-loaded with a "get" method. Then each place you'd specify an ENV var, you define a string to use with get(). Then the format of the file is of no consequence.

So you'd pass a "config" object into the dashdash constructor, then for each option call get() on the config object with the appropriate string and have the returned value used for defaults.

konobi avatar Mar 02 '16 00:03 konobi