lib/message-go.js
function go(from, to){
  var toStream;

  Step(
    function checkParams(){
      _checkParams(from, to, this)
    },

    function(err, checkResult){
      var checkResultOfFrom;
      var checkResultOfTo;

      if(err){ 
        log.error('invalid options');
        throw err;
        return;
      }

      checkResultOfFrom =  checkResult.from;
      checkResultOfTo = checkResult.to;

      if(!checkResultOfTo.isFile){
        throw new Error('-t should specify a file but not a directory');
      }

      Step(
        function resolveFrom(){
          if(checkResultOfFrom.isFile){
            return [checkResultOfFrom.path];
          }else if(checkResultOfFrom.isDirectory){
            utils.walk(checkResultOfFrom.path, function(file){
              return path.extname(file) === '.js';
            }, this);
          }
        },

        function action(err, files){
          var group;
          if(err){ throw err; }
          
          group = this.group();
          toStream = fs.createWriteStream(to, {flags: 'a'});

          for(var i = 0, l = files.length; i < l; i++){
            goByFile(files[i], toStream, group());
          }
        },

        function showStats(err, numbers){
          var totally = 0;
          if(err){
            throw err;
          }

          toStream.end();

          numbers.forEach(function(number){
            totally = totally + number;
          });

          if(totally > 0){
            console.log('--------');
            console.log('Totally ' + clc.red(totally) + ' messages have gone to ' +
                clc.green(to));
          }else{
            console.log(clc.red('No') + ' messages found in ' + clc.cyan(from));
          }

        }
      );

    }
  )
}
function go(from, to){
  var toStream;

  Step(
    function checkParams(){
      _checkParams(from, to, this)
    },

    function(err, checkResult){
      var checkResultOfFrom;
      var checkResultOfTo;

      if(err){ 
        log.error('invalid options');
        throw err;
        return;
      }

      checkResultOfFrom =  checkResult.from;
      checkResultOfTo = checkResult.to;

      if(!checkResultOfTo.isFile){
        throw new Error('-t should specify a file but not a directory');
      }

      Step(
        function resolveFrom(){
          if(checkResultOfFrom.isFile){
            return [checkResultOfFrom.path];
          }else if(checkResultOfFrom.isDirectory){
            utils.walk(checkResultOfFrom.path, function(file){
              return path.extname(file) === '.js';
            }, this);
          }
        },

        function action(err, files){
          var group;
          if(err){ throw err; }
          
          group = this.group();
          toStream = fs.createWriteStream(to, {flags: 'a'});

          for(var i = 0, l = files.length; i < l; i++){
            goByFile(files[i], toStream, group());
          }
        },

        function showStats(err, numbers){
          var totally = 0;
          if(err){
            throw err;
          }

          toStream.end();

          numbers.forEach(function(number){
            totally = totally + number;
          });

          if(totally > 0){
            console.log('--------');
            console.log('Totally ' + clc.red(totally) + ' messages have gone to ' +
                clc.green(to));
          }else{
            console.log(clc.red('No') + ' messages found in ' + clc.cyan(from));
          }

        }
      );

    }
  )
}
function go ( from , to ) { var toStream ; Step ( function checkParams ( ) { _checkParams ( from , to , this ) } , function ( err , checkResult ) { var checkResultOfFrom ; var checkResultOfTo ; if ( err ) { log . error ( 'invalid options' ) ; throw err ; return ; } checkResultOfFrom = checkResult . from ; checkResultOfTo = checkResult . to ; if ( ! checkResultOfTo . isFile ) { throw new Error ( '-t should specify a file but not a directory' ) ; } Step ( function resolveFrom ( ) { if ( checkResultOfFrom . isFile ) { return [ checkResultOfFrom . path ] ; } else if ( checkResultOfFrom . isDirectory ) { utils . walk ( checkResultOfFrom . path , function ( file ) { return path . extname ( file ) === '.js' ; } , this ) ; } } , function action ( err , files ) { var group ; if ( err ) { throw err ; } group = this . group ( ) ; toStream = fs . createWriteStream ( to , { flags : 'a' } ) ; for ( var i = 0 , l = files . length ; i < l ; i ++ ) { goByFile ( files [ i ] , toStream , group ( ) ) ; } } , function showStats ( err , numbers ) { var totally = 0 ; if ( err ) { throw err ; } toStream . end ( ) ; numbers . forEach ( function ( number ) { totally = totally + number ; } ) ; if ( totally > 0 ) { console . log ( '--------' ) ; console . log ( 'Totally ' + clc . red ( totally ) + ' messages have gone to ' + clc . green ( to ) ) ; } else { console . log ( clc . red ( 'No' ) + ' messages found in ' + clc . cyan ( from ) ) ; } } ) ; } ) }
Let messages go from FROM to TO
@param {String} from directory or file the messages come from
@param {String} to file the message go to
Let messages go from FROM to TO