diff options
| author | Ellie Huxtable <e@elm.sh> | 2021-02-15 23:33:30 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-15 23:33:30 +0000 |
| commit | 41f072a8b443b5a404916598f0c9b7a52f5c05fb (patch) | |
| tree | 449643847a5fee7c290976075a2f6fb36547aca0 /src/command/init.rs | |
| parent | Satisfy clippy (diff) | |
| download | atuin-41f072a8b443b5a404916598f0c9b7a52f5c05fb.zip | |
Add init command (#12)
* Add init command
This makes setting up the shell part of A'tuin much easier. Eval the
output of "atuin init".
* Update readme, add up binding
Diffstat (limited to '')
| -rw-r--r-- | src/command/init.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/command/init.rs b/src/command/init.rs new file mode 100644 index 00000000..022021d0 --- /dev/null +++ b/src/command/init.rs @@ -0,0 +1,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")) + } +} |
