atuin/src/command/init.rs

37 lines
621 B
Rust
Raw Normal View History

2022-04-06 23:32:11 -06:00
use clap::Parser;
2021-04-26 04:50:31 -06:00
2022-04-06 23:32:11 -06:00
#[derive(Parser)]
2021-04-26 04:50:31 -06:00
pub enum Cmd {
2022-04-06 23:32:11 -06:00
/// Zsh setup
2021-04-26 04:50:31 -06:00
Zsh,
2022-04-06 23:32:11 -06:00
/// Bash setup
2021-04-26 04:50:31 -06:00
Bash,
2022-04-06 23:32:11 -06:00
/// Fish setup
Fish,
2021-04-26 04:50:31 -06:00
}
fn init_zsh() {
let full = include_str!("../shell/atuin.zsh");
println!("{}", full);
}
2021-04-26 04:50:31 -06:00
fn init_bash() {
let full = include_str!("../shell/atuin.bash");
println!("{}", full);
}
fn init_fish() {
let full = include_str!("../shell/atuin.fish");
println!("{}", full);
}
2021-04-26 04:50:31 -06:00
impl Cmd {
pub fn run(&self) {
2021-04-26 04:50:31 -06:00
match self {
Self::Zsh => init_zsh(),
Self::Bash => init_bash(),
Self::Fish => init_fish(),
2021-04-26 04:50:31 -06:00
}
}
}