/tasks

Terminal task list for synchronous code

Primary LanguageJavaScriptMIT LicenseMIT

@hjvedvik/tasks

This package shares many similarities with listr, but is more suited for synchronous code.

  

Install

npm install @hjvedvik/tasks

Usage

const Tasks = require('@hjvedvik/tasks')

const tasks = new Tasks([
  {
    title: 'Simple task',
    task: (context, task) => {
      // task.setProgress(1, 5)
      // task.setStatus('')
      // task.setSummary('')
      // task.fail('')
    }
  },
  {
    title: 'Sub tasks',
    skip: () => true, // true, false, string
    task: () => new Tasks([
      {
        title: 'Another task',
        task: () => {
          // task.setProgress(1, 10)
        }
      }
    ])
  }
])

tasks.run({
  // context
})

Roadmap for v1.0

  • Render in TTY and non-TTY environments
  • Determine a stable API
  • Create tests