Skip to content

Progress bar

This component represents a long-running step in the execution of a command showing the current progress and the time it took to complete, once finished.

PropertyValue
InteractivityNon-required. The component supports non-interactive mode.

Demo

Interactive

It shows the execution of a command with an interactive progress bar step

Non-interactive

It shows the execution of a command with a non-interactive progress bar step

API

Example

swift
try await Noora().progressStep(
    message: "Processing the graph",
    successMessage: "Project graph processed",
    errorMessage: "Failed to process the project graph"
) { updateProgress in
    for step in steps {
        try await runStep()
        // Use updateProgress to update the progress. The value should be between 0 and 1.
        updateProgress(step / steps)
    }
}

Options

AttributeDescriptionRequiredDefault value
messageThe message to show to the userYes
successMessageThe message to show to the user when the step is successfulNo
errorMessageThe message to show to the user when the step failsNo
taskThe task to executeYes

Released under the MIT License.