From d57f549855caf8ab90b5ea0ae7cc9445f3abedfc Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Thu, 21 Apr 2022 10:12:56 +0100 Subject: refactor commands for better separation (#313) * refactor commands for better separation * fmt --- src/command/client/init.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/command/client/init.rs (limited to 'src/command/client/init.rs') diff --git a/src/command/client/init.rs b/src/command/client/init.rs new file mode 100644 index 00000000..a2c6378c --- /dev/null +++ b/src/command/client/init.rs @@ -0,0 +1,36 @@ +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(), + } + } +} -- cgit v1.3.1