Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need support for periods in an option string? #147

Open
zeachco opened this issue Apr 26, 2016 · 6 comments
Open

Need support for periods in an option string? #147

zeachco opened this issue Apr 26, 2016 · 6 comments

Comments

@zeachco
Copy link

zeachco commented Apr 26, 2016

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
Copy link
Owner

dthree commented May 5, 2016

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
Copy link
Owner

dthree commented May 5, 2016

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

@GranularDetective
Copy link

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

@zeachco
Copy link
Author

zeachco commented May 5, 2016

Ha sorry, yeah. Did that in a rush

@zeachco zeachco changed the title options sub keys need a parent option placeholder which can pollute help May 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants
@zeachco @dthree @GranularDetective and others