Skip to main content

Module tasks

Module tasks 

Source
Expand description

Sequential task runner — ports @clack/prompts tasks().

Each task gets its own spinner and runs in order; a task may return a final message that replaces its title on success.

§Example

use cli_ui::prompt::{tasks, Task};

tasks(vec![
    Task::new("Linting", |s| {
        std::thread::sleep(std::time::Duration::from_millis(400));
        s.message("Checking imports");
        std::thread::sleep(std::time::Duration::from_millis(400));
        Some("Lint clean".into())
    }),
    Task::new("Testing", |_| {
        std::thread::sleep(std::time::Duration::from_millis(500));
        Some("42 passing".into())
    }),
]);

Structs§

Task

Functions§

tasks
Run a list of tasks in order, each with its own spinner.