shellcomp 0.1.13

Shell completion installation and activation helpers for Rust CLI tools
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use shellcomp::{Shell, default_install_path, detect_activation};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    for shell in [Shell::Bash, Shell::Zsh, Shell::Fish] {
        let path = default_install_path(shell.clone(), "demo")?;
        let activation = detect_activation(shell.clone(), "demo")?;

        println!("Shell: {shell}");
        println!("Managed path: {}", path.display());
        println!("Activation: {activation:#?}");
        println!();
    }

    Ok(())
}