atuin/src/command/init.rs

31 lines
553 B
Rust
Raw Normal View History

use eyre::Result;
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,
}
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);
}
2021-04-26 04:50:31 -06:00
impl Cmd {
pub fn run(&self) -> Result<()> {
match self {
Self::Zsh => init_zsh(),
Self::Bash => init_bash(),
}
Ok(())
}
}