summaryrefslogtreecommitdiffstats
path: root/src/command/init.rs
blob: 022021d0c890ff378279a8973e5823471f9c7911 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use std::env;

use eyre::{eyre, Result};

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

pub fn init() -> Result<()> {
    let shell = env::var("SHELL")?;

    if shell.ends_with("zsh") {
        init_zsh();
        Ok(())
    } else {
        Err(eyre!("Could not detect shell, or shell unsupported"))
    }
}