Expand description
Common CLI utilities for Rust command-line applications.
This crate provides:
- Colored console output helpers (success, error, warning, info)
- String truncation for display
- Table styling utilities (requires
tablesfeature) - Clap argument helpers (requires
clapfeature)
§Features
tables- Enables table styling withtabledclap- Enables clap argument helper extensionserrors- Enables exit code mapping withsysexitsfull- Enables all features
Structs§
- Padding
- Padding is responsible for a left/right/top/bottom inner indent of a particular cell.
- Styled
Table - A builder for styled tables.
Enums§
- Table
Style - Available table styles for CLI output.
Constants§
- DEFAULT_
TRUNCATION_ SUFFIX - Default suffix appended to truncated strings.
Functions§
- display_
option - Formats an optional value for rendering in a table cell.
- display_
option_ or - Formats an optional value with a default.
- format_
bold - Formats a value as bold.
- format_
dimmed - Formats a value as dimmed/muted.
- format_
error - Formats a value as error (red).
- format_
info - Formats a value as info (blue).
- format_
success - Formats a value as success (green).
- format_
warning - Formats a value as warning (yellow).
- print_
dimmed - Prints a dimmed/muted message.
- print_
error - Prints an error message to stderr with a red X prefix.
- print_
info - Prints an info message with a blue arrow prefix.
- print_
success - Prints a success message with a green checkmark prefix.
- print_
warning - Prints a warning message with a yellow exclamation prefix.
- truncate_
middle - Truncates a string in the middle, keeping start and end.
- truncate_
string - Truncates a string to a maximum number of characters.
- truncate_
with_ suffix - Truncates a string with a custom suffix.