diff options
| author | Ellie Huxtable <e@elm.sh> | 2021-03-20 00:50:31 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-20 00:50:31 +0000 |
| commit | 716c7722cda29bf612508bb96f51822a86e0f69e (patch) | |
| tree | fa3c4c192fc05b078397fcd510d39ae78e46abfa /src/local/history.rs | |
| parent | Add config file support (#15) (diff) | |
| download | atuin-716c7722cda29bf612508bb96f51822a86e0f69e.zip | |
Add TUI, resolve #19, #17, #16 (#21)
Diffstat (limited to 'src/local/history.rs')
| -rw-r--r-- | src/local/history.rs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/local/history.rs b/src/local/history.rs index 05600b80..0ca112bd 100644 --- a/src/local/history.rs +++ b/src/local/history.rs @@ -1,8 +1,9 @@ use std::env; +use std::hash::{Hash, Hasher}; use crate::command::uuid_v4; -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct History { pub id: String, pub timestamp: i64, @@ -42,3 +43,21 @@ impl History { } } } + +impl PartialEq for History { + // for the sakes of listing unique history only, we do not care about + // anything else + // obviously this does not refer to the *same* item of history, but when + // we only render the command, it looks the same + fn eq(&self, other: &Self) -> bool { + self.command == other.command + } +} + +impl Eq for History {} + +impl Hash for History { + fn hash<H: Hasher>(&self, state: &mut H) { + self.command.hash(state); + } +} |
