index.js
function(parsed) {
            var end = false, message = "", code = 0, outer = console.log;
            var setted = Object.keys(self);
            var specced = Object.keys(parsed);
            var required = arrayDiff(setted, specced);
            var unexpected = arrayDiff(specced, setted);
            
            // If any required options is not provided - crash it!
            if (required.length) {
                end = true;
                code = 1;
                outer = console.error;
                message += "Required but not provided:\n    --" 
                        + required.join("\n    --") + "\n";
            }
            // + unexpected
            if (unexpected.length) {
                message += "Unexpected options:\n    --"
                        + unexpected.join("\n    --") + "\n";
            }
            message += (message.length ? 
                    "\nRun with --help for more info" : "");
            
            if (strict && message.length) {
                end = true;
                code = 1;
                outer = console.error;
            }
            
            // If --help, exit without error
            if (incoming.indexOf("--help") != -1) {
                end = true;
                code = 0;
                outer = console.log;
                message = Object.keys(parsed).reduce(function(msg, k) {
                    return msg + parsed[k].note + "\n    --" + k
                    + (parsed[k].req ? " *required\n" : "\n");
                    }, "") + "Help. This message.\n    --help\n";
            }
            
            if (end) {
                // exiting
                outer(banner + "\n");
                outer(message);
                process.exit(code);
            }
        }
function(parsed) {
            var end = false, message = "", code = 0, outer = console.log;
            var setted = Object.keys(self);
            var specced = Object.keys(parsed);
            var required = arrayDiff(setted, specced);
            var unexpected = arrayDiff(specced, setted);
            
            // If any required options is not provided - crash it!
            if (required.length) {
                end = true;
                code = 1;
                outer = console.error;
                message += "Required but not provided:\n    --" 
                        + required.join("\n    --") + "\n";
            }
            // + unexpected
            if (unexpected.length) {
                message += "Unexpected options:\n    --"
                        + unexpected.join("\n    --") + "\n";
            }
            message += (message.length ? 
                    "\nRun with --help for more info" : "");
            
            if (strict && message.length) {
                end = true;
                code = 1;
                outer = console.error;
            }
            
            // If --help, exit without error
            if (incoming.indexOf("--help") != -1) {
                end = true;
                code = 0;
                outer = console.log;
                message = Object.keys(parsed).reduce(function(msg, k) {
                    return msg + parsed[k].note + "\n    --" + k
                    + (parsed[k].req ? " *required\n" : "\n");
                    }, "") + "Help. This message.\n    --help\n";
            }
            
            if (end) {
                // exiting
                outer(banner + "\n");
                outer(message);
                process.exit(code);
            }
        }
function ( parsed ) { var end = false , message = "" , code = 0 , outer = console . log ; var setted = Object . keys ( self ) ; var specced = Object . keys ( parsed ) ; var required = arrayDiff ( setted , specced ) ; var unexpected = arrayDiff ( specced , setted ) ; // If any required options is not provided - crash it!
 if ( required . length ) { end = true ; code = 1 ; outer = console . error ; message += "Required but not provided:\n    --" + required . join ( "\n    --" ) + "\n" ; } // + unexpected
 if ( unexpected . length ) { message += "Unexpected options:\n    --" + unexpected . join ( "\n    --" ) + "\n" ; } message += ( message . length ? "\nRun with --help for more info" : "" ) ; if ( strict && message . length ) { end = true ; code = 1 ; outer = console . error ; } // If --help, exit without error
 if ( incoming . indexOf ( "--help" ) != - 1 ) { end = true ; code = 0 ; outer = console . log ; message = Object . keys ( parsed ) . reduce ( function ( msg , k ) { return msg + parsed [ k ] . note + "\n    --" + k + ( parsed [ k ] . req ? " *required\n" : "\n" ) ; } , "" ) + "Help. This message.\n    --help\n" ; } if ( end ) { // exiting
 outer ( banner + "\n" ) ; outer ( message ) ; process . exit ( code ) ; } }
Check conditions. If help setted - always exit.
@param parsed Parsed specs
Check conditions . If help setted - always exit .