Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Parse alternate to `process.argv`. IF/ELSE loads from CLI and loads from inclusion in another script
initialize from alternate in CLI commander.js script
Included as a module in nodejs
instead of process.argv
if (require.main === module) {
// node module_initialized.commander.js --some_arg --another
} else {
process.argv arguments *may* not be ideal,
conflicting or broken when included as module.
ex: access the script file as a module
const tools = require("module_initialized.commander.js");
_.extend(module.exports, {
parse:function(args) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.