vorpal icon indicating copy to clipboard operation
vorpal copied to clipboard

Argument detected as option

Open chapterjason opened this issue 6 years ago • 1 comments

I use Vorpal for a short time and recently found the following issue.

This is my code:

const vorpal = require('vorpal')();

vorpal.command('add [text...]', '...')
    .types({ string: ['text'] })
    .action(function(args, cb){
        console.log(args);
        cb();
    });

vorpal.execSync('add "-test"');

The output is the following:

  Invalid option: 't'. Showing Help:

  Usage: add [options] [text...]

  ...

  Options:

    --help  output usage information

After some debugging I found out that https://github.com/dthree/vorpal/blob/master/lib/util.js#L22 is removing the quotes.

chapterjason avatar Mar 15 '18 23:03 chapterjason

Run into the same problem. That behaviour breaks usage of any strings started with -

Also minimist seems to be unsupported for years substack/minimist#115 Maybe it should be replaced with yargs-parser Minimist2 at the moment breaks more tests. yargs-parser has only one integration test failed. And it will be possibly easier to fix. Also yargs-parser is actively maintained

Moving to yargs-parser seem to fix this bug

zyuhel avatar Jul 14 '18 06:07 zyuhel