Skip to content

Commit

Permalink
feat(list): services auto-completion shows billable services with dol…
Browse files Browse the repository at this point in the history
…lar sign
  • Loading branch information
Ephigenia committed Apr 17, 2019
1 parent d527e06 commit 8ab0340
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/lib/auto-complete/completions/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module.exports = async ({ words, prev }) => {
return miteApi.getServices({ archived: false }).then(
service => service.map(c => ({
name: String(c.id),
description: c.name
description: c.name + (c.billable ? ' $' : '')
}))
);
case '--sort':
Expand Down
5 changes: 4 additions & 1 deletion source/lib/mite-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ function miteApiWrapper(config) {
return {

mite: mite,
getMyself: async function() {
return util.promisify(this.mite.getMyself)().then(data => data.user);
},

sort: function(items, attribute) {
// @TODO add assertions
Expand Down Expand Up @@ -40,7 +43,7 @@ function miteApiWrapper(config) {
util.promisify(mite['get' + itemNamePluralCamelCased])(opts),
util.promisify(mite['getArchived' + itemNamePluralCamelCased])(opts),
])
.then(results => [].concat(results[0], results[1]))
.then(results => Array.prototype.concat.apply([], results))
.then(items => items.map(c => c[itemName]))
.then(items => items.filter(item => {
if (typeof options.archived === 'boolean') {
Expand Down

0 comments on commit 8ab0340

Please sign in to comment.