pub struct CliConfig {
pub prog_name: Option<String>,
pub extensions_dir: Option<String>,
pub registry: Option<Arc<dyn RegistryProvider>>,
pub executor: Option<Arc<dyn ModuleExecutor>>,
pub extra_commands: Vec<Command>,
pub group_depth: usize,
}Expand description
Configuration for creating a CLI that uses a pre-populated registry instead of filesystem discovery.
Frameworks that register modules at runtime (e.g. apflow’s bridge) can
build their own RegistryProvider + ModuleExecutor and pass them
here to skip the default filesystem scan.
§Example
ⓘ
use std::sync::Arc;
let config = apcore_cli::CliConfig {
prog_name: Some("myapp".to_string()),
registry: Some(Arc::new(my_provider)),
executor: Some(Arc::new(my_executor)),
..Default::default()
};
// Use config.registry / config.executor at dispatch time instead of
// performing filesystem discovery with FsDiscoverer.Fields§
§prog_name: Option<String>Override the program name shown in help text.
extensions_dir: Option<String>Override extensions directory (only used when registry is None).
registry: Option<Arc<dyn RegistryProvider>>Pre-populated registry provider. When set, skips filesystem discovery.
executor: Option<Arc<dyn ModuleExecutor>>Pre-built module executor. When set, skips executor construction.
extra_commands: Vec<Command>Extra custom commands to add to the CLI root. Each entry is a
clap::Command that will be registered as a subcommand.
group_depth: usizeGroup depth for multi-level module grouping (default: 1). Higher values allow deeper dotted-name grouping.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CliConfig
impl !RefUnwindSafe for CliConfig
impl Send for CliConfig
impl Sync for CliConfig
impl Unpin for CliConfig
impl UnsafeUnpin for CliConfig
impl !UnwindSafe for CliConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more