From 31f9b8938d07e687c94c0168d9d9abd334cf0c0c Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Tue, 3 Feb 2026 16:21:19 -0800 Subject: fix(search): allow hyphen-prefixed query args like `---` (#3129) Resolves #3028 ## Checks - [ ] I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle - [ ] I have checked that there are no existing pull requests for the same thing --- crates/atuin/src/command/client/search.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/crates/atuin/src/command/client/search.rs b/crates/atuin/src/command/client/search.rs index ceeb9436..cb03420a 100644 --- a/crates/atuin/src/command/client/search.rs +++ b/crates/atuin/src/command/client/search.rs @@ -85,6 +85,7 @@ pub struct Cmd { #[arg(long)] human: bool, + #[arg(allow_hyphen_values = true)] query: Option>, /// Show only the text of the command @@ -325,3 +326,27 @@ async fn run_non_interactive( Ok(results) } + +#[cfg(test)] +mod tests { + use super::Cmd; + use clap::Parser; + + #[test] + fn search_for_triple_dash() { + // Issue #3028: searching for `---` should not be treated as a CLI flag + let cmd = Cmd::try_parse_from(["search", "---"]); + assert!(cmd.is_ok(), "Failed to parse '---' as a query: {cmd:?}"); + let cmd = cmd.unwrap(); + assert_eq!(cmd.query, Some(vec!["---".to_string()])); + } + + #[test] + fn search_for_double_dash_value() { + // Searching for strings starting with -- should also work + let cmd = Cmd::try_parse_from(["search", "--", "--foo"]); + assert!(cmd.is_ok()); + let cmd = cmd.unwrap(); + assert_eq!(cmd.query, Some(vec!["--foo".to_string()])); + } +} -- cgit v1.3.1