lib/patsy.js
function(chunk) {


      var patsy = this;

      chunk = chunk.trim();

      if(chunk == 'exit'){

        this.scripture.print('[King Arthur]'.magenta + ': On second thought, let\'s not go to Camelot, it\'s a silly place. I am leaving you behind squire!\n');

        program.prompt('[Patsy]'.cyan + ': Sire, do you really want to leave me here all alone? [Y/n] (enter for yes): ', function(proceed){

          // Did he answer yes? (or DEFAULT)
          if (( proceed.search(/yes|y|j|ja/g) !== -1 ) ||
              (( proceed.trim() === '' ))) {

            util.print('[King Arthur]'.magenta + ': I hold your oath fullfilled!\n');

            patsy.die();

          }
          // Did he answer no?
          else if( proceed.search(/no|n|nei/g) !== -1 ) {

            util.print('[King Arthur]'.magenta + ': No, I am just pulling your leg mate! \n');
            util.print('[Patsy]'.cyan + ': <shrugs> \n');


          }
          // No valid input
          else {

            util.print('[King Arthur]'.magenta + ': I can\'t do that!? It\'s to silly! I\'m leaving, come Patsy! <sound of two half coconuts banging together fading out..>\n');
            process.exit();

          }

        });


      } else if(chunk == 'test') {
        this.scripture.print('[Patsy]'.yellow + ': Running tests!\n');
        this.runTests();

      }
    }
function(chunk) {


      var patsy = this;

      chunk = chunk.trim();

      if(chunk == 'exit'){

        this.scripture.print('[King Arthur]'.magenta + ': On second thought, let\'s not go to Camelot, it\'s a silly place. I am leaving you behind squire!\n');

        program.prompt('[Patsy]'.cyan + ': Sire, do you really want to leave me here all alone? [Y/n] (enter for yes): ', function(proceed){

          // Did he answer yes? (or DEFAULT)
          if (( proceed.search(/yes|y|j|ja/g) !== -1 ) ||
              (( proceed.trim() === '' ))) {

            util.print('[King Arthur]'.magenta + ': I hold your oath fullfilled!\n');

            patsy.die();

          }
          // Did he answer no?
          else if( proceed.search(/no|n|nei/g) !== -1 ) {

            util.print('[King Arthur]'.magenta + ': No, I am just pulling your leg mate! \n');
            util.print('[Patsy]'.cyan + ': <shrugs> \n');


          }
          // No valid input
          else {

            util.print('[King Arthur]'.magenta + ': I can\'t do that!? It\'s to silly! I\'m leaving, come Patsy! <sound of two half coconuts banging together fading out..>\n');
            process.exit();

          }

        });


      } else if(chunk == 'test') {
        this.scripture.print('[Patsy]'.yellow + ': Running tests!\n');
        this.runTests();

      }
    }
function ( chunk ) { var patsy = this ; chunk = chunk . trim ( ) ; if ( chunk == 'exit' ) { this . scripture . print ( '[King Arthur]' . magenta + ': On second thought, let\'s not go to Camelot, it\'s a silly place. I am leaving you behind squire!\n' ) ; program . prompt ( '[Patsy]' . cyan + ': Sire, do you really want to leave me here all alone? [Y/n] (enter for yes): ' , function ( proceed ) { // Did he answer yes? (or DEFAULT) if ( ( proceed . search ( / yes|y|j|ja / g ) !== - 1 ) || ( ( proceed . trim ( ) === '' ) ) ) { util . print ( '[King Arthur]' . magenta + ': I hold your oath fullfilled!\n' ) ; patsy . die ( ) ; } // Did he answer no? else if ( proceed . search ( / no|n|nei / g ) !== - 1 ) { util . print ( '[King Arthur]' . magenta + ': No, I am just pulling your leg mate! \n' ) ; util . print ( '[Patsy]' . cyan + ': <shrugs> \n' ) ; } // No valid input else { util . print ( '[King Arthur]' . magenta + ': I can\'t do that!? It\'s to silly! I\'m leaving, come Patsy! <sound of two half coconuts banging together fading out..>\n' ) ; process . exit ( ) ; } } ) ; } else if ( chunk == 'test' ) { this . scripture . print ( '[Patsy]' . yellow + ': Running tests!\n' ) ; this . runTests ( ) ; } }
Function to check current input from stdin

@param   String  chunk
@calls   this.die
Function to check current input from stdin