Skip to content
This repository was archived by the owner on Sep 7, 2018. It is now read-only.
This repository was archived by the owner on Sep 7, 2018. It is now read-only.

[posix-argv-parser] Compound short options and operands are conflated #394

@jcoglan

Description

@jcoglan

(Posting here on the advice of @cjno due to busterjs/posix-argv-parser not having issues open.)

This program:

var pap = require('posix-argv-parser'),
    parser = pap.create();

parser.createOption(['--config', '-c'], {hasValue: false});
parser.createOption(['--length', '-l'], {hasValue: true});
parser.createOperand('service');

parser.parse(['-cl', '10'], function(error, options) {
  console.error(error);
  console.log(options);
});

Produces the following output:

{ '--config': 
   { isSet: true,
     value: undefined,
     timesSet: 1,
     signature: '--config/-c' },
  '-c': 
   { isSet: true,
     value: undefined,
     timesSet: 1,
     signature: '--config/-c' },
  '--length': { isSet: true, value: '', timesSet: 1, signature: '--length/-l' },
  '-l': { isSet: true, value: '', timesSet: 1, signature: '--length/-l' },
  service: { isSet: true, value: '10', timesSet: 1, signature: 'service' } }

Whereas it should set --length to '10' and leave service undefined.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions