summaryrefslogtreecommitdiffstats
path: root/src/command/init.rs
blob: ed1555a992be7b1be3049f88842bb7b16e3bd6ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use std::env;

use eyre::{eyre, Result};
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);
}

fn init_bash() {
    let full = include_str!("../shell/atuin.bash");
    println!("{}", full);
}

impl Cmd {
    pub fn run(&self) -> Result<()> {
        match self {
            Self::Zsh => init_zsh(),
            Self::Bash => init_bash(),
        }
        Ok(())
    }
}