Skip to content

Options are always empty #1761

@PsotnyPerun

Description

@PsotnyPerun

Hi,
I've been trying both my own code and code from the samples, and whatever I do options are always empty.
But let's stick with the examples - I've been trying using this one: https://github.com/tj/commander.js/blob/master/examples/pizza. I've been trying to pass a custom string to --cheese option but whatever I do, options in program.opts() are always empty. They only get populated if there is a default value specified in option() function.

On a Win machine, I've been running the script with npm run start --cheese=my_value or npm run start -c my_value and nothing would work. Even if the options are bools, adding --peppers still wouldn't work.

I've been trying both the latest version (9.3.0) and some old ones from a year ago.

Am I missing something obvious here?
Thanks!

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