Expand description
CLI utilities for command-line applications.
This module provides common patterns for CLI applications including:
- Reading input from files, stdin, or command-line arguments
- Writing output to files or stdout
- Formatting and printing results with different output formats
- Error handling and exit codes
The [repl] sub-module provides a shared REPL scaffold and is enabled
via the repl crate feature.
Enums§
- Output
Format - Output format for CLI results.
Functions§
- exit_if
- Exits the process with an error code if condition is true.
- expand_
home_ dir - Expand a leading
~/in a path to the user’s home directory. - parse_
package_ spec - Parse a
name@versionpackage specification into(name, version). - print_
result - Prints a result, handling errors with proper formatting.
- print_
with_ format - Prints a value with the specified output format.
- read_
input - Reads input from a file, inline string, or stdin.
- read_
json - Reads and parses JSON from a file.
- write_
output - Writes content to a file or stdout.