diff options
Diffstat (limited to 'src/actions/gen_completions.rs')
-rw-r--r-- | src/actions/gen_completions.rs | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/actions/gen_completions.rs b/src/actions/gen_completions.rs deleted file mode 100644 index e8e11ca..0000000 --- a/src/actions/gen_completions.rs +++ /dev/null @@ -1,35 +0,0 @@ -use std::io; -use structopt::clap::Shell; -use structopt::StructOpt; - -use crate::cli::CommandLine; -use crate::KhResult; - -#[derive(Debug, StructOpt)] -pub struct GenCompletionsArgs { - /// the shell - #[structopt(name = "shell", raw(possible_values = "&ShellArg::variants()"))] - pub shell: ShellArg, -} - -arg_enum! { -#[derive(Debug)] - pub enum ShellArg{ - Bash, - Zsh, - Fish, - Elvish - } -} - -pub fn gen_completions(args: &GenCompletionsArgs) -> KhResult<()> { - let mut app = CommandLine::clap(); - let binary_name = "khaleesi"; - match args.shell { - ShellArg::Bash => app.gen_completions_to(binary_name, Shell::Bash, &mut io::stdout()), - ShellArg::Zsh => app.gen_completions_to(binary_name, Shell::Zsh, &mut io::stdout()), - ShellArg::Fish => app.gen_completions_to(binary_name, Shell::Fish, &mut io::stdout()), - ShellArg::Elvish => app.gen_completions_to(binary_name, Shell::Elvish, &mut io::stdout()), - } - Ok(()) -} |