Skip to content

bug: custom completion with promise does trigger validation #1235

@buehler

Description

@buehler

Hey there, I'm currently experiencing the following bug:

When using completions, a synchronuous handler does not trigger the validation (which is correct),
but when I have a command foobar <arg> and try to use the completion node . --get-yargs-completions foobar with a custom completion handler that returns a promise

.completion('completion', false as any, (_, argv: Arguments) => {
        return Promise.resolve(['asdf']);
      }),

It does trigger the validation of the required argument and therefor executes the completion handler, but then the process gets exited with the error that a required argument is missing.

Also, when using promises, the handler of the command is executed as well.

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