osc94
Library for handling progress bar sequences (OSC 9;4).
💡 Example
#
#
See more examples in the examples directory.
📖 Usage
Usually, you'll only need the [Progress] struct, which provides a high-level interface and handles clean up job for you when dropped. If you need finer control, you can use the [OSC94] struct and [ProgressState] enum. See the documentation of respective API for more details.
🚩 Feature flags
Default features include std.
| Feature | Default | Description |
|---|---|---|
std |
Yes | Enables [Progress], which writes progress sequences to std::io::Write destinations. |
cli |
No | Enables the osc94 binary. This also enables std. |
Disable default features to use the crate in no_std contexts:
= { = "0.1", = false }
With default features disabled, [OSC94] and [ProgressState] remain available for formatting progress sequences, while [Progress] is not exported.
📥 Binary
The provided binary allows you to play with progress bar sequences:
$ osc94
Sets the progress state and value of the progress bar for 1 second.
Usage: osc94 <state> <progress>
States:
0/hidden
1/normal
2/error
3/indeterminate
4/warning
Progress: 0-100
It can be installed via the following methods:
Using binstall
cargo binstall osc94
Downloading from Releases
Navigate to the Releases page and download respective binary for your platform. Make sure to give it execute permissions.
Compiling from Source
cargo install osc94 --features cli
🎉 Credits
- Microsoft Docs on progress bar sequences (GitHub)