diff options
| author | Gokul <appu.yess@gmail.com> | 2025-04-02 17:07:36 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-02 12:37:36 +0100 |
| commit | fa84d02f014486a7deccc5dbe09520fdb9a5d910 (patch) | |
| tree | e6c47b5a0b6ba33ebe04c77beee9107b5554dc55 /crates | |
| parent | feat: Binaries as subcommands (#2661) (diff) | |
| download | atuin-fa84d02f014486a7deccc5dbe09520fdb9a5d910.zip | |
fix: allow -ve values for timezone (#2609)
* allow -ve values for timezone
* allow optional values for timezone
* clippy fixes
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/atuin/src/command/client/search.rs | 11 |
1 files 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<Timezone>, + #[arg(allow_hyphen_values = true)] + // Clippy warns about `Option<Option<T>>`, but we suppress it because we need + // this distinction for proper argument handling. + #[allow(clippy::option_option)] + timezone: Option<Option<Timezone>>, /// 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, |
