From c56f8ff736b8369b9b5cb3bdb42718396247f212 Mon Sep 17 00:00:00 2001 From: Matthieu LAURENT Date: Mon, 29 Jan 2024 13:17:36 +0100 Subject: Add xonsh support (#1375) * Add basic xonsh support * Add init xonsh command * Add Xonsh install instructions in docs * Add xonsh ctrl-R search * update xonsh script and instructions Summary of changes: * Added duration to postcommand hook * Switched main search operation to use `subproccess.run()` rather than running as an xonsh shell command - this a) allows us to capture stderr without needing a temporary file and b) avoids a weird broken-buffer state that results from running a fullscreen TUI and then programmatically editing the buffer * Added support for immediately executing chosen command via `__atuin_accept__:` (like bash/zsh/fish) * strip newline from command before sending to atuin * Add basic xonsh support * Add init xonsh command * Add xonsh ctrl-R search * Remove advanced-install guide (was accidentally re-added during rebase) * Clean up Xonsh doesn't import private functions into the local namespace when sourcing a file * Add xonsh ro readme * Respect ATUIN_NOBIND * Format with black, and improve PEP8 compliance * Add up search * Format rust code --------- Co-authored-by: Joseph Montanaro --- atuin-common/src/utils.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'atuin-common/src/utils.rs') diff --git a/atuin-common/src/utils.rs b/atuin-common/src/utils.rs index 87c4b14c..889c7811 100644 --- a/atuin-common/src/utils.rs +++ b/atuin-common/src/utils.rs @@ -101,6 +101,11 @@ pub fn is_bash() -> bool { env::var("ATUIN_SHELL_BASH").is_ok() } +pub fn is_xonsh() -> bool { + // only set on xonsh + env::var("ATUIN_SHELL_XONSH").is_ok() +} + /// Extension trait for anything that can behave like a string to make it easy to escape control /// characters. /// -- cgit v1.3.1