atuin/src/command/init.rs

37 lines
692 B
Rust
Raw Normal View History

2021-04-26 04:50:31 -06:00
use structopt::StructOpt;
#[derive(StructOpt)]
pub enum Cmd {
#[structopt(about = "zsh setup")]
Zsh,
#[structopt(about = "bash setup")]
Bash,
#[structopt(about = "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
}
}
}