Expand description
Output formatting and colored output utilities for IPFRS CLI
This module provides utilities for formatting CLI output with colors, tables, and different output modes (text, JSON, compact).
§Examples
use ipfrs_cli::output::{OutputStyle, format_bytes, format_bytes_detailed};
// Create output style
let style = OutputStyle::new(true, "text");
// Format file sizes
let size = format_bytes(1048576);
assert_eq!(size, "1.00 MB");
let detailed = format_bytes_detailed(1234567);
assert_eq!(detailed, "1.18 MB (1234567 bytes)");Structs§
- Output
Style - Output style configuration for controlling formatting and colors
- Table
Printer - Table printer for formatted output
Functions§
- compact_
cid - Print CID in compact mode
- compact_
kv_ pairs - Print key-value pairs in compact mode
- compact_
list - Print list in compact mode (one item per line)
- compact_
print - Print in compact mode (minimal output)
- error
- Print an error message
- format_
bytes - Format bytes as human-readable size
- format_
bytes_ detailed - Format bytes with both human-readable and exact value
- info
- Print an info message
- is_tty
- Check if stdout is a TTY (terminal)
- print_
cid - Print a CID (content identifier) with highlighting
- print_
header - Print a header/title
- print_
kv - Print a key-value pair
- print_
list_ item - Print a list item
- print_
numbered_ item - Print a numbered list item
- print_
section - Print a section header
- success
- Print a success message
- troubleshooting_
hint - Print troubleshooting hint for common errors
- warning
- Print a warning message
- write_
raw - Write raw bytes to stdout (for binary output)