Skip to content

Commit

Permalink
add threads command
Browse files Browse the repository at this point in the history
  • Loading branch information
tomquirk committed May 10, 2019
1 parent 841abb6 commit 0188dda
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/commands/command-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ const commands = {
});
},

[commandTypes.THREADS.command]() {
return new Promise(resolve => {
const threads = this.messen.store.threads.getThreadList();
if (threads.length === 0)
return resolve("You haven't sent any messages yet!");

const threadNames = threads.map(thread => thread.name).join("\n");

return resolve(threadNames);
});
},

/**
* Displays usage instructions
* @return {Promise<String>}
Expand All @@ -132,7 +144,7 @@ const commands = {
.objectValues(commandTypes)
.filter(command => command.help)
.map(type => {
return `${chalk.blue(type.command)}`;
return chalk.blue(type.command);
})
.join("\n")}`;

Expand Down Expand Up @@ -202,7 +214,7 @@ const commands = {
logText = chalk.dim(logText);
}

return `${logText}`;
return logText;
})
.join("\n");

Expand Down

0 comments on commit 0188dda

Please sign in to comment.