dthree / vorpal

Node's framework for interactive CLIs
http://vorpal.js.org
MIT License
5.64k stars 280 forks source link

Need support for periods in an option string? #147

Open zeachco opened 8 years ago

zeachco commented 8 years ago

let say I want options like --vpn.user=bob; vpn.host=sub.domain.net; ... adding

vorpal
    .command('...')
    .option('--vpn.user', '...')
    .option('--vpn.host', '...')

would throw an error as options.vpn is not set

so we need to do

vorpal
    .command('...')
    .option('--vpn')
    .option('--vpn.user', '...')
    .option('--vpn.host', '...')

even we don't have usage for vpn option. this pollute the help generation, is prone to making errors and is kind of a boiler plate

maybe we could use something like https://www.npmjs.com/package/objectkit to auto create path ?

dthree commented 8 years ago

Got it.

This is probably just a parsing point, I probably didn't intend support for periods in an option string, but I never documented that and there's probably not a reason I can't.

This is where the options are initially parsed.

https://github.com/dthree/vorpal/blob/master/lib/option.js#L15

I'll try to look further into it when I get a sec, but feel free to look around.

dthree commented 8 years ago

@PeterDCarter he was referring to adding necessary boilerplate (or figuratively trash) to the code, obscuring its clarity.

GranularDetective commented 8 years ago

@dthree Why would you want to pollute your own code?

zeachco commented 8 years ago

Ha sorry, yeah. Did that in a rush