UNPKG

tender-cli

Version:

Command line interface for Tender

57 lines (46 loc) 2.63 kB
// Generated by CoffeeScript 1.6.2 var Reporter, ThreadReporter, 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'); ThreadReporter = (function(_super) { __extends(ThreadReporter, _super); function ThreadReporter() { this.format = __bind(this.format, this); _ref = ThreadReporter.__super__.constructor.apply(this, arguments); return _ref; } ThreadReporter.prototype.format = function(callback) { var comment, df, index, internal, str, tags, _i, _len, _ref1; 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"; _ref1 = this.data.comments; for (index = _i = 0, _len = _ref1.length; _i < _len; index = ++_i) { comment = _ref1[index]; if (!(index > 0)) { continue; } internal = comment.internal ? '[internal]' : ''; str = "---------------------------------------------------------------------\nDate: " + (moment(this.data.created_at).format(df)) + " " + internal + "\nFrom: " + comment.author_name + " (" + comment.author_email + ") \n\n" + comment.body + "\n"; this.output += str; } return callback(); }; return ThreadReporter; })(Reporter); module.exports = function(options, callback) { return new ThreadReporter(options, callback); }; module.exports.description = "Basic headers with all comments";