Skip to content

Move parsed options into a data object #514

@ericuldall

Description

@ericuldall

First off, I really like this plugin. I've written argv parsing snippets more times than I like and they always come out different. This is a much needed piece of code.

One thing I think would be a good addition is moving all the parsed options into a data object. This would allow us to abstract away all the private data from the public data a user is trying to access.

Instead of

if( program.myoption ){ //do something with myoption}

We can do

if( program.has('myoption') ){ program.get('myoption') }
//also would allow us to easily get all options
console.log(program.get_options()); //returns an object of all parsed options

I haven't dug too deep into this packages code, so perhaps there's an implementation detail that makes storing data this way less than simple. If not, then I'd like to see it work this way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions