Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The many2 : [path] example does not seem to work #57

Closed
silkentrance opened this issue Nov 25, 2015 · 1 comment
Closed

The many2 : [path] example does not seem to work #57

silkentrance opened this issue Nov 25, 2015 · 1 comment

Comments

@silkentrance
Copy link
Contributor

Using [email protected] and [email protected] and given the following source 'command'

#!/usr/bin/env /usr/bin/node
var path = require('path');
var nopt = require('nopt');
var parsed = nopt({
    's': [path]
});
console.log(parsed);

By making this executable, I then invoke it by

./command -s /tmp -s /bin -s /var

The output will be

{ s: '/var',
  argv: 
   { remain: [],
     cooked: [ '-s', '/tmp', '-s', '/bin', '-s', '/var' ],
     original: [ '-s', '/tmp', '-s', '/bin', '-s', '/var' ] } }

I would have expected the following, though

{ s: ['/tmp', '/bin', '/var'],
  argv: 
   { remain: [],
     cooked: [ '-s', '/tmp', '-s', '/bin', '-s', '/var' ],
     original: [ '-s', '/tmp', '-s', '/bin', '-s', '/var' ] } }

Am I doing something wrong here?

@silkentrance
Copy link
Contributor Author

Found it. The documentation is off. It must read

"many2" : [path, Array]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant