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

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

Closed
jcoglan opened this issue Dec 26, 2013 · 1 comment
Closed
Assignees
Labels

Comments

@jcoglan
Copy link

jcoglan commented Dec 26, 2013

(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.

@dkl-ppi dkl-ppi added the Bug label Mar 7, 2014
@dkl-ppi dkl-ppi self-assigned this Mar 7, 2014
@dkl-ppi
Copy link
Member

dkl-ppi commented Mar 24, 2014

Fixed by bba3e4cc3f.

@dkl-ppi dkl-ppi closed this as completed Mar 24, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants