git_gardener/commands/
completion.rs1use crate::error::Result;
2use clap::ValueEnum;
3
4#[derive(ValueEnum, Clone, Debug)]
5pub enum CompletionShell {
6 Bash,
7 Zsh,
8 Fish,
9}
10
11pub struct CompletionCommand {
12 pub shell: CompletionShell,
13}
14
15impl CompletionCommand {
16 pub fn new(shell: CompletionShell) -> Self {
17 Self { shell }
18 }
19
20 pub fn execute(&self) -> Result<()> {
21 let completion_content = match self.shell {
22 CompletionShell::Bash => include_str!("../../completions/git-gardener.bash"),
23 CompletionShell::Zsh => include_str!("../../completions/git-gardener.zsh"),
24 CompletionShell::Fish => include_str!("../../completions/git-gardener.fish"),
25 };
26
27 println!("{}", completion_content);
28 Ok(())
29 }
30}