dthree / vorpal

Node's framework for interactive CLIs

Home Page:http://vorpal.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Argument detected as option

chapterjason opened this issue · 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.

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