Module output

Module output 

Source
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§

OutputStyle
Output style configuration for controlling formatting and colors
TablePrinter
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)