Skip to content

Replace yargs.getValidationInstance() + monkey-patched requiredArguments with non-hacky alternative #1930

@Rob--W

Description

@Rob--W

In web-ext we support config files to override the CLI parameters. The location of the config files (and whether to use them at all) can be configured via the CLI parameters. So we need to parse the CLI parameters before reading the config.

But by default, yargs exits early (or at least prints an error, if exitProcess is false) when a required parameter is not passed via the CLI. This would prevent us from reading required parameters from config files. I fixed this by monkey-patching yargs's validation via (yargsInstance).getValidationInstance() in #1928 . This is kind of a hack, but at least it will unbreak a long-standing issue (#1327).

If there is a better way to support reading required parameters from config files instead of just the CLI, then we should replace the hack from #1928 with that method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions