Skip to content

Commit

Permalink
Check if using zsh
Browse files Browse the repository at this point in the history
  • Loading branch information
ellie committed Oct 19, 2023
1 parent a806a0c commit a87c2b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions atuin-common/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ pub fn get_current_dir() -> String {
}
}

pub fn is_zsh() -> bool {
// only set on zsh
env::var("ZSH_VERSION").is_ok()
}

#[cfg(test)]
mod tests {
use time::Month;
Expand Down
3 changes: 2 additions & 1 deletion atuin/src/command/client/search/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::{
time::Duration,
};

use atuin_common::utils;
use crossterm::{
event::{
self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode, KeyEvent, KeyModifiers,
Expand Down Expand Up @@ -702,7 +703,7 @@ pub async fn history(

if index < results.len() {
let mut command = results.swap_remove(index).command;
if accept {
if accept && utils::is_zsh() {
command = String::from("__atuin_accept__:") + &command;
}
// index is in bounds so we return that entry
Expand Down

0 comments on commit a87c2b9

Please sign in to comment.