Skip to content

default value interferes with passing context to sub-commands #724

@bcoe

Description

@bcoe

setting a default value for a global option overrides the context object.

yargs()
          .command('batman', 'batman command', function (yargs) {
            yargs.command('robin', 'robin command', {}, function (_argv) {
              argv = _argv
            })
          })
          .option('state', {
            default: undefined,
            global: true
          })
          .parse('batman robin --what', {
            state: 'grumpy but rich'
          }, function (_err, argv, _output) {})

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions