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
Commandtrait - Styled output, gradients, progress, tables
- Interactive shell (via built-in
shellcommand) - Optional JSON command loading (
json-loader) - Optional plugin loading (
plugins)
§JSON Loader (feature: json-loader)
use modcli::ModCli;
#[cfg(feature = "json-loader")]
use modcli::loader::sources::JsonFileSource;
let mut cli = ModCli::new();
#[cfg(feature = "json-loader")]
{
let source = JsonFileSource::new("modcli/examples/commands.json");
cli.registry.load_from(Box::new(source));
}
let args: Vec<String> = std::env::args().skip(1).collect();
cli.run(args);§Plugins (feature: plugins)
use modcli::ModCli;
let mut cli = ModCli::new();
#[cfg(feature = "plugins")]
{
cli.registry.load_plugins("./plugins");
}
let args: Vec<String> = std::env::args().skip(1).collect();
cli.run(args);Re-exports§
pub use crate::command::Command as CliCustom;
Modules§
- command
- commands
- config
- console
- custom
- input
- loader
- output
- Output utilities for styled text, gradients, progress, and tables.
- parser
- shell_
commands - shell_
extensions
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).