| Crates.io | zsh-module |
| lib.rs | zsh-module |
| version | 0.3.0 |
| created_at | 2023-01-16 12:23:02.036099+00 |
| updated_at | 2023-02-01 00:01:45.377542+00 |
| description | A High-level framework for creating zsh modules |
| homepage | |
| repository | |
| max_upload_size | |
| id | 760138 |
| size | 29,215 |
This is a high level crate that allows you to define your own zsh module. It is in a very early state but it can be used to define commands.
In the future, most zsh module functionality will be added. Feel free to send a PR if you would like to add more functionality :)
Features:
zshstd::os APIs.stdin fd.
std::io::stdin, but it can break in specific ocasions.Take a look at our online documentation for a quick guide.
Making a module is very easy, here's an excerpt from our example module greeter
use zsh_module::{Builtin, MaybeError, Module, ModuleBuilder, Opts};
// Notice how this module gets installed as `rgreeter`
zsh_module::export_module!(rgreeter, setup);
struct Greeter;
impl Greeter {
fn greet_cmd(&mut self, _name: &str, _args: &[&str], _opts: Opts) -> MaybeError {
println!("Hello, world!");
Ok(())
}
}
fn setup() -> Result<Module, Box<dyn std::error::Error>> {
let module = ModuleBuilder::new(Greeter)
.builtin(Greeter::greet_cmd, Builtin::new("greet"))
.build();
Ok(module)
}