diff --git a/lib/render.js b/lib/render.js index 41bcf457..7e97895d 100644 --- a/lib/render.js +++ b/lib/render.js @@ -61,12 +61,11 @@ class Render { return {title, correlation}; } - _buildPrefix(item) { + _buildPrefix(item, key) { const prefix = []; - const {_id} = item; - prefix.push(' '.repeat(4 - String(_id).length)); - prefix.push(grey(`${_id}.`)); + prefix.push(' '.repeat(4 - String(key).length)); + prefix.push(grey(`${(key + 1)}.`)); return prefix.join(' '); } @@ -97,13 +96,14 @@ class Render { return log(titleObj); } - _displayItemByBoard(item) { - const {_isTask, isComplete} = item; + _displayItemByBoard(item, key) { + const {_id, _isTask, isComplete} = item; const age = this._getAge(item._timestamp); const star = this._getStar(item); - const prefix = this._buildPrefix(item); - const message = this._buildMessage(item); + const prefix = this._buildPrefix(item, key); + const _idPrefix = `${blue(`${_id}`)}${' '.repeat(4 - String(_id).length)}`; + const message = _idPrefix + ': ' + this._buildMessage(item); const suffix = (age.length === 0) ? star : `${age} ${star}`; const msgObj = {prefix, message, suffix}; @@ -115,13 +115,14 @@ class Render { return note(msgObj); } - _displayItemByDate(item) { - const {_isTask, isComplete} = item; + _displayItemByDate(item, key) { + const {_id, _isTask, isComplete} = item; const boards = item.boards.filter(x => x !== 'My Board'); const star = this._getStar(item); - const prefix = this._buildPrefix(item); - const message = this._buildMessage(item); + const prefix = this._buildPrefix(item, key); + const _idPrefix = `${blue(`${_id}`)}${' '.repeat(4 - String(_id).length)}`; + const message = _idPrefix + ': ' + this._buildMessage(item); const suffix = `${this._colorBoards(boards)} ${star}`; const msgObj = {prefix, message, suffix}; @@ -139,11 +140,11 @@ class Render { return; } this._displayTitle(board, items); - items.forEach(item => { + items.forEach((item, key) => { if (item._isTask && item.isComplete && !this._configuration.displayCompleteTasks) { return; } - this._displayItemByBoard(item); + this._displayItemByBoard(item, key); }); }); } @@ -154,11 +155,11 @@ class Render { return; } this._displayTitle(date, items); - items.forEach(item => { + items.forEach((item, key) => { if (item._isTask && item.isComplete && !this._configuration.displayCompleteTasks) { return; } - this._displayItemByDate(item); + this._displayItemByDate(item, key); }); }); }