Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

cli-battery-pack

A battery pack for building CLI applications in Rust.

Quick Start

cargo bp add cli

Want progress bars too?

cargo bp add cli -F indicators

License

Licensed under either of:

at your option.

Battery pack contents

User Input

Argument parsing and interactive prompts

NameDescription
configXDG/platform config directories (etcetera)

Terminal Output

Color, hyperlinks, and progress display

NameDescription
indicatorsProgress bars and spinners (indicatif + console)
Crates: console, indicatif

Dependencies

NameDescription
anstreamIO stream adapters for writing colored text that will gracefully degrade according to your terminal’s capabilities.
anstyleANSI text styling
anstyle-hyperlinkANSI escape code hyperlinks (OSC 8)
anyhowFlexible concrete Error type built on std::error::Error
clapA simple to use, efficient, and full-featured Command Line Argument Parser
colorchoice-clapClap mixin to override console colors
dialoguerA command line prompting library.
human-panicPanic messages for humans
ignore
regexAn implementation of regular expressions for Rust. This implementation uses finite automata and guarantees linear time matching on all inputs.
supports-hyperlinksDetects whether a terminal supports rendering hyperlinks.
wildGlob (wildcard) expanded command-line arguments on Windows

Dev dependencies

NameDescription
snapboxSnapshot testing toolbox

Templates

NameDescription
simpleMinimal CLI with argument parsing
subcmdsCLI with subcommands