use std::io;
use anyhow::Result;
use clap::CommandFactory;
use clap_complete::Shell;
use crate::cli::Cli;
const BASH_GIT_SHIM: &str = r#"
_git_stk() {
local cur prev
COMP_WORDS=("git-stk" "${COMP_WORDS[@]:2}")
COMP_CWORD=$((COMP_CWORD - 1))
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD - 1]}"
_git-stk git-stk "$cur" "$prev"
}
"#;
pub fn print(shell: Shell) -> Result<()> {
let mut command = Cli::command();
clap_complete::generate(shell, &mut command, "git-stk", &mut io::stdout());
if shell == Shell::Bash {
print!("{BASH_GIT_SHIM}");
}
Ok(())
}