Skip to content

Commit

Permalink
add list command for completion
Browse files Browse the repository at this point in the history
  • Loading branch information
Shota Sawada authored and jakepearson committed Oct 9, 2018
1 parent d9ba09f commit d1fd3cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bin/cli.js
Expand Up @@ -16,6 +16,11 @@ cli.command('help', 'Display task description', (input, flags) => {
return runner.getHelp(input)
})

cli.command('list', 'Display task list', (input, flags) => {
const runner = require('..')(flags)
return runner.getList()
})

cli.on('error', err => {
if (err.name === 'MaidError') {
require('../lib/logger').error(chalk.red(err.message))
Expand Down
5 changes: 5 additions & 0 deletions lib/index.js
Expand Up @@ -151,6 +151,11 @@ class Maid {
'\n'
)
}

getList() {
const tasks = this.maidfile.tasks
console.log(tasks.map(task => task.name).join('\n'))
}
}

function checkTypes(task, types) {
Expand Down

0 comments on commit d1fd3cc

Please sign in to comment.