# ff-cli
A pluggable command-line framework for building extensible CLI applications in Rust.
## Features
- 🔌 Plugin-based architecture
- 🚀 Easy to extend with custom commands
- 📦 Ready for crates.io publication
- 🛠️ Multiple plugin integration approaches
## Installation
```bash
cargo install ff-cli
```
## Usage
```bash
ff-cli help
ff-cli version
```
## Plugin Development
### Approach 1: Compile-time Plugins (Recommended for initial release)
Create plugins as separate crates that implement the `Command` trait:
```rust
use ff_cli::plugin::Command;
use anyhow::Result;
pub struct MyCommand;
impl Command for MyCommand {
fn name(&self) -> &str {
"mycommand"
}
fn description(&self) -> &str {
"My custom command"
}
fn execute(&self, args: &[String]) -> Result<()> {
println!("Executing with args: {:?}", args);
Ok(())
}
}
```
Then add the plugin as a dependency and register it in main.
### Approach 2: Dynamic Plugins (Future feature)
Enable the `dynamic-plugins` feature to load plugins at runtime from shared libraries.
## Plugin Integration Approaches
### 1. **Compile-time Integration** (Current - Best for v0.1.0)
- Plugins are Rust crates added as dependencies
- Type-safe and fast
- No runtime loading overhead
- Easy to publish and version control
### 2. **Workspace-based Plugins**
- Use Cargo workspace for plugin organization
- All plugins in one repository
- Share common code easily
### 3. **Dynamic Loading with libloading**
- Load `.so`/`.dylib`/`.dll` at runtime
- More flexible but requires careful API design
- Enable with `dynamic-plugins` feature
### 4. **WebAssembly Plugins (WASM)**
- Future approach using wasmtime/wasmer
- Cross-platform, sandboxed execution
- Good for untrusted plugins
### 5. **Process-based Plugins**
- Each plugin is a separate executable
- Similar to `git` subcommands
- Maximum isolation, language-agnostic
## Recommended Approach for v0.1.0
Start with **compile-time plugins** for the initial release:
- Simpler to implement and maintain
- Better performance and security
- Easier for users to integrate
- Can evolve to dynamic loading later
## License
MIT OR Apache-2.0