tender-cli
Version:
Command line interface for Tender
47 lines (36 loc) • 2.01 kB
JavaScript
// Generated by CoffeeScript 1.6.2
var BasicReporter, Reporter, moment, _ref,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Reporter = require('../../reporter');
moment = require('moment');
BasicReporter = (function(_super) {
__extends(BasicReporter, _super);
function BasicReporter() {
this.format = __bind(this.format, this); _ref = BasicReporter.__super__.constructor.apply(this, arguments);
return _ref;
}
BasicReporter.prototype.format = function(callback) {
var df, tags;
if (!this.data) {
return callback();
}
tags = "";
tags += this.data.unread ? "[unacknowledged] " : "[acknowledged] ";
tags += this.data.responded ? "[unresponded] " : "[responded] ";
tags += this.data["public"] ? "[public] " : "[private] ";
if (this.data.hidden) {
tags += "[hidden] ";
}
tags += "[via " + this.data.via + "] ";
df = 'M/D/YYYY H:MM a';
this.output = "Discussion #" + this.data.id + "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\nTitle : " + this.data.title + "\nAuthor : " + this.data.author_name + " (" + this.data.author_email + ")\nCreated : " + (moment(this.data.created_at).format(df)) + "\nURL : " + this.data.html_href + "\nState : " + this.data.state + "\nComments : " + this.data.comments_count + "\nDetails : " + tags + "\n\nDescription:\n\n" + this.data.comments[0].body + " \n";
return callback();
};
return BasicReporter;
})(Reporter);
module.exports = function(options, callback) {
return new BasicReporter(options, callback);
};
module.exports.description = "Basic headers and the first comment";