Expand description
ModCLI — a lightweight, modular CLI framework for Rust.
§Quick Start
use modcli::ModCli;
let args: Vec<String> = std::env::args().skip(1).collect();
let mut cli = ModCli::new();
cli.run(args);
§Features
- Custom commands via the
Command
trait - Styled output, gradients, progress, tables
- Optional internal helper commands
Note: Runtime plugins and JSON/config loaders have been removed from core for security and performance. Configure your CLI directly in code.
Re-exports§
pub use crate::command::Command as CliCustom;
Modules§
- command
- commands
- custom
- error
- input
- loader
- output
- Output utilities for styled text, gradients, progress, and tables.
- parser
Macros§
- banner
- Register a banner with custom code using a block. Example: banner!({ println!(“Hello”); })
- banner_
file - Register a banner from a file path (evaluated at runtime).
- banner_
text - Register a simple text banner that prints a single line and a newline.
Structs§
- ModCli
- Represents a CLI application and provides command registration and dispatch.
Functions§
- modcli_
version - Returns the version of the ModCLI framework (from
modcli/Cargo.toml
). - set_
startup_ banner - Registers a startup banner callback that will be invoked once, the first time
ModCli::run()
is called in this process. If the environment variableMODCLI_DISABLE_BANNER
is set to “1” or “true” (case-insensitive), the banner will be suppressed. - set_
startup_ banner_ from_ file - Registers a startup banner from a UTF-8 text file. The contents are read immediately and stored; at runtime the stored text is printed when the banner runs. Returns Err if the file cannot be read.