From fa84d02f014486a7deccc5dbe09520fdb9a5d910 Mon Sep 17 00:00:00 2001 From: Gokul Date: Wed, 2 Apr 2025 17:07:36 +0530 Subject: fix: allow -ve values for timezone (#2609) * allow -ve values for timezone * allow optional values for timezone * clippy fixes --- crates/atuin/src/command/client/search.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/atuin/src/command/client/search.rs b/crates/atuin/src/command/client/search.rs index 7cc879f5..7298209b 100644 --- a/crates/atuin/src/command/client/search.rs +++ b/crates/atuin/src/command/client/search.rs @@ -112,7 +112,11 @@ pub struct Cmd { /// - the special value "local" (or "l") which refers to the system time zone /// - an offset from UTC (e.g. "+9", "-2:30") #[arg(long, visible_alias = "tz")] - timezone: Option, + #[arg(allow_hyphen_values = true)] + // Clippy warns about `Option>`, but we suppress it because we need + // this distinction for proper argument handling. + #[allow(clippy::option_option)] + timezone: Option>, /// Available variables: {command}, {directory}, {duration}, {user}, {host}, {time}, {exit} and /// {relativetime}. @@ -260,7 +264,10 @@ impl Cmd { None => Some(settings.history_format.as_str()), _ => self.format.as_deref(), }; - let tz = self.timezone.unwrap_or(settings.timezone); + let tz = match self.timezone { + Some(Some(tz)) => tz, // User provided a value + Some(None) | None => settings.timezone, // No value was provided + }; super::history::print_list( &entries, -- cgit v1.3.1