dominictarr / npmd

MIT License
450 stars 37 forks source link

option parsing issues #29

Closed ghost closed 10 years ago

ghost commented 10 years ago

The way npmd currently works, plugins can't easily specify their own option parsing. This presently creates a bug where:

npmd install -g browserify

doesn't work but

npmd install browserify -g

works. This is because the install command can't tell the option parsing that -g is a boolean option, so the next argument shouldn't be parsed. The threading of the config option with rc throughout the program is also problematic because certain other argument options like the config.cache directory are inserted onto what the rc module provides. It would possibly be much cleaner for each plugin to handle option parsing itself by looking at process.argv and then only thread the configuration through to modules, not the configuration along with the arguments.

dominictarr commented 10 years ago

with rc you can pass in a parsed argv object, https://github.com/dominictarr/rc/blob/master/index.js#L11

so, we can just do that from npmd with the types defined for global and the other options that need a shortcut.

dominictarr commented 10 years ago

this is fixed now.