2 releases

0.0.6 Jun 1, 2024
0.0.5 Apr 16, 2024

#11 in #shrs

MIT/Apache

41KB
244 lines

shrs_rhai_completion

Support for adding completions with Rhai scripts

crates.io MIT/Apache 2.0

This is a plugin for shrs, which adds support for adding tab completion with Rhai scripts. Tab completions in various shells such as fish usually use scripts to handle completions and this plugin mirrors that. For shrs, this allows scripts to be decoupled from the shell code so they can be easily modified. There will also be a set of curated Rhai scripts which can easily be copied without having to build it into the shell. This also makes generating completions easy since other tools can be easily modified to generate Rhai scripts instead.

Using this plugin

First add this plugin to your dependencies

shrs_rhai_completion = { version = "0.0.6" }

Then include this plugin when initializing shrs

Also, add completions scripts to ~/.config/shrs/completions A list of written completions can be found in completions

use shrs::prelude::*;
use shrs_completion::completions::*;

fn main() {
    let myshell = ShellBuilder::default()
        .with_plugin(CompletionsPlugin)
        .build()
        .unwrap();

    myshell.run().unwrap();
}

Dependencies

~20–37MB
~540K SLoC