atuin/src/command/init.rs
c-14 045c87fbcd
Allow stateless commands to be run without config/database ()
* Allow stateless commands to be run without config/database

Fixes an issue where gen-completions fails trying to create a config
directory in restrained build environments/distribution.

* move non-db commands up to core subcommands

* re-add lost lines

* re-add lost lines

Co-authored-by: Conrad Ludgate <conrad.ludgate@truelayer.com>
2022-09-25 11:15:33 +01:00

36 lines
621 B
Rust

use clap::Parser;
#[derive(Parser)]
pub enum Cmd {
/// Zsh setup
Zsh,
/// Bash setup
Bash,
/// Fish setup
Fish,
}
fn init_zsh() {
let full = include_str!("../shell/atuin.zsh");
println!("{}", full);
}
fn init_bash() {
let full = include_str!("../shell/atuin.bash");
println!("{}", full);
}
fn init_fish() {
let full = include_str!("../shell/atuin.fish");
println!("{}", full);
}
impl Cmd {
pub fn run(&self) {
match self {
Self::Zsh => init_zsh(),
Self::Bash => init_bash(),
Self::Fish => init_fish(),
}
}
}