bin/cli.js
function addTime(options, client) {
    return function(next, project) {
        var dates = options.dates;
        delete options.dates;
        var join = futures.join();
        join.add(dates.map(function(date) {
            var promise = futures.future();
            // we must clone to prevent options.date override
            var opts = utils.clone(options);
            opts.date = date;
            var message = ('Save '+ opts.time + ' ' +
                           (opts.billable ? 'billable' : 'non billable') +
                           ' hours for '+ opts.date);
            intervals.addTime(project, opts, client, function (err, res) {
                var msg = 'OK';
                if (err) { msg = 'ERROR'; console.error(err); }
                else if (res.status != 201) { msg = 'ERROR'; console.error('Unexpected status '+ res.status +' for addTime method'); };
                console.log(message + ' ' + msg);
                promise.deliver();
            });
            return promise;
        }));
        join.when(function() {
            next(project);
        });
    };
}
function addTime(options, client) {
    return function(next, project) {
        var dates = options.dates;
        delete options.dates;
        var join = futures.join();
        join.add(dates.map(function(date) {
            var promise = futures.future();
            // we must clone to prevent options.date override
            var opts = utils.clone(options);
            opts.date = date;
            var message = ('Save '+ opts.time + ' ' +
                           (opts.billable ? 'billable' : 'non billable') +
                           ' hours for '+ opts.date);
            intervals.addTime(project, opts, client, function (err, res) {
                var msg = 'OK';
                if (err) { msg = 'ERROR'; console.error(err); }
                else if (res.status != 201) { msg = 'ERROR'; console.error('Unexpected status '+ res.status +' for addTime method'); };
                console.log(message + ' ' + msg);
                promise.deliver();
            });
            return promise;
        }));
        join.when(function() {
            next(project);
        });
    };
}
function addTime ( options , client ) { return function ( next , project ) { var dates = options . dates ; delete options . dates ; var join = futures . join ( ) ; join . add ( dates . map ( function ( date ) { var promise = futures . future ( ) ; // we must clone to prevent options.date override var opts = utils . clone ( options ) ; opts . date = date ; var message = ( 'Save ' + opts . time + ' ' + ( opts . billable ? 'billable' : 'non billable' ) + ' hours for ' + opts . date ) ; intervals . addTime ( project , opts , client , function ( err , res ) { var msg = 'OK' ; if ( err ) { msg = 'ERROR' ; console . error ( err ) ; } else if ( res . status != 201 ) { msg = 'ERROR' ; console . error ( 'Unexpected status ' + res . status + ' for addTime method' ) ; } ; console . log ( message + ' ' + msg ) ; promise . deliver ( ) ; } ) ; return promise ; } ) ) ; join . when ( function ( ) { next ( project ) ; } ) ; } ; }
Add time for each dates specified
Add time for each dates specified