adobe-research / node-theseus

76 stars 13 forks source link

simplify command line options #8

Closed guozheng closed 11 years ago

guozheng commented 11 years ago

currently, we have two command line options:

--theseus-verbose means set verbose to 1

--theseus-verbose=1 | 2 means set verbose to 1 or 2, from code, seems like u can set 0-9

--theseus-include-modules means to instrument node_modules as well

can we make these options shorter:

--theseus-verbose => --verbose or -v --theseus-verbose=1 | 2 => --verbose=1 | 2 or -v -vv --theseus-include-modules => --include-modules

actually, it would be really nice to switch to use:

optimist: https://github.com/substack/node-optimist commander.js: https://github.com/visionmedia/commander.js/ nopt: https://github.com/isaacs/nopt

also, it would be really nice if in the README.md, we add these command line options ;-)

I am more than happy to help...

alltom commented 11 years ago

You can pick any number between 0 and 9999999999999999.... :)

node-theseus should be as much of a drop-in replacement for node as possible. Ideally, if you replaced node with node-theseus in any script, the only difference would be that your program is instrumented. Toward that end, node-theseus removes all flags that it recognizes from process.argv before invoking the original script. That's why they have names that it's very unlikely another script will also use (--theseus-*) and that's why it doesn't use an options parsing library (I didn't check whether any library had an option to remove recognized flags from process.argv because, well, it seems like a generally weird option to have).

That said, the code isn't tested in a wide variety of situations and may not actually work as well as I hope it does. Patches are welcome if you think it can be done better.

Thanks for the reminder to update the README!