8c30205b02
Shell completion scripts can be generated for `bash`, `elvish`, `fish`, `powershell`, and `zsh` with the `completions` subcommand: $ imdl completions --shell zsh > imdl.zsh The same scripts are available in the `completions` directory. Please refer to your shell's documentation for more information on how to install and use completion scripts. type: added
36 lines
630 B
Rust
36 lines
630 B
Rust
use super::*;
|
|
|
|
use structopt::clap;
|
|
|
|
#[derive(EnumVariantNames, EnumString)]
|
|
#[strum(serialize_all = "kebab-case")]
|
|
pub(crate) enum Shell {
|
|
Zsh,
|
|
Bash,
|
|
Fish,
|
|
Powershell,
|
|
Elvish,
|
|
}
|
|
|
|
impl Into<clap::Shell> for Shell {
|
|
fn into(self) -> clap::Shell {
|
|
match self {
|
|
Self::Bash => clap::Shell::Bash,
|
|
Self::Fish => clap::Shell::Fish,
|
|
Self::Zsh => clap::Shell::Zsh,
|
|
Self::Powershell => clap::Shell::PowerShell,
|
|
Self::Elvish => clap::Shell::Elvish,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn variants() {
|
|
assert_eq!(Shell::VARIANTS, clap::Shell::variants())
|
|
}
|
|
}
|