Skip to content

Commit

Permalink
feat(list): --user_id auto-completion shows you at the current user
Browse files Browse the repository at this point in the history
  • Loading branch information
Ephigenia committed Apr 17, 2019
1 parent a3906bd commit d527e06
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions source/lib/auto-complete/completions/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,15 @@ module.exports = async ({ words, prev }) => {
case '--tracking':
return ['yes', 'no'];
case '--user_id':
// add completion for customer ids?
// @TODO show archived users in grey
return miteApi.getUsers({ archived: false }).then(
users => users.map(c => ({
name: String(c.id),
description: c.name
return Promise.all([
miteApi.getUsers({ archived: false }),
miteApi.getMyself(),
]).then(([users, me]) => {
return users.map(u => ({
name: String(u.id),
description: u.name + (me.id === u.id ? ' (you)' : '')
}))
);
});
}

return [
Expand Down

0 comments on commit d527e06

Please sign in to comment.