yargs/yargs

Strict mode not working for positional arguments

Open

#1.076 aberto em 21 de fev. de 2018

Ver no GitHub
 (4 comments) (9 reactions) (0 assignees)JavaScript (1.053 forks)batch import
Help Wantedbugp2

Métricas do repositório

Stars
 (10.829 stars)
Métricas de merge de PR
 (Mesclagem média 113d 19h) (11 fundiu PRs em 30d)

Description

When positional arguments are defined using .usage or .positional you can still supply extra arguments in strict mode without getting an error. I used the following work-around to avoid this, but I think strict should handle this by itself.

.check((argv, opts) => {
  if (argv._.length) {
    return "Too many positional arguments were passed.";
  }

  return true;
})
.strict()

Great package, thanks!

Guia do colaborador