Skip to content

Commit fa84d02

Browse files
authored
fix: allow -ve values for timezone (#2609)
* allow -ve values for timezone * allow optional values for timezone * clippy fixes
1 parent 653894d commit fa84d02

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

crates/atuin/src/command/client/search.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ pub struct Cmd {
112112
/// - the special value "local" (or "l") which refers to the system time zone
113113
/// - an offset from UTC (e.g. "+9", "-2:30")
114114
#[arg(long, visible_alias = "tz")]
115-
timezone: Option<Timezone>,
115+
#[arg(allow_hyphen_values = true)]
116+
// Clippy warns about `Option<Option<T>>`, but we suppress it because we need
117+
// this distinction for proper argument handling.
118+
#[allow(clippy::option_option)]
119+
timezone: Option<Option<Timezone>>,
116120

117121
/// Available variables: {command}, {directory}, {duration}, {user}, {host}, {time}, {exit} and
118122
/// {relativetime}.
@@ -260,7 +264,10 @@ impl Cmd {
260264
None => Some(settings.history_format.as_str()),
261265
_ => self.format.as_deref(),
262266
};
263-
let tz = self.timezone.unwrap_or(settings.timezone);
267+
let tz = match self.timezone {
268+
Some(Some(tz)) => tz, // User provided a value
269+
Some(None) | None => settings.timezone, // No value was provided
270+
};
264271

265272
super::history::print_list(
266273
&entries,

0 commit comments

Comments
 (0)