aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@atuin.sh>2026-02-03 16:21:19 -0800
committerGitHub <noreply@github.com>2026-02-03 16:21:19 -0800
commit31f9b8938d07e687c94c0168d9d9abd334cf0c0c (patch)
tree58ee60bc8baac82d41ed4ec1ec5b5a356fae81a2
parentchore: update agents.md (#3126) (diff)
downloadatuin-31f9b8938d07e687c94c0168d9d9abd334cf0c0c.zip
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
-rw-r--r--crates/atuin/src/command/client/search.rs25
1 files changed, 25 insertions, 0 deletions
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<Vec<String>>,
/// 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()]));
+ }
+}