diff options
| author | Ellie Huxtable <ellie@elliehuxtable.com> | 2023-06-14 21:18:24 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-14 21:18:24 +0100 |
| commit | ae1709dafd22ac3c64441472e90df8799253292e (patch) | |
| tree | 88d1cb17af6af9948d44ffb7242d69be5743785d /atuin-client/src/database.rs | |
| parent | Bump debian from bullseye-20230502-slim to bullseye-20230612-slim (#1047) (diff) | |
| download | atuin-ae1709dafd22ac3c64441472e90df8799253292e.zip | |
Key values (#1038)
* wip
* Start testing
* Store host IDs, not hostnames
Why? Hostnames can change a lot, and therefore host filtering can be
funky. Really, all we want is a unique ID per machine + do not care what
it might be.
* Mostly just write a fuckload of tests
* Add a v0 kv store I can push to
* Appending works
* Add next() and iterate, test the pointer chain
* Fix sig
* Make clippy happy and thaw the ICE
* Fix tests'
* Fix tests
* typed builder and cleaner db trait
---------
Co-authored-by: Conrad Ludgate <conrad.ludgate@truelayer.com>
Diffstat (limited to '')
| -rw-r--r-- | atuin-client/src/database.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/atuin-client/src/database.rs b/atuin-client/src/database.rs index 22bd5886..a2d8c533 100644 --- a/atuin-client/src/database.rs +++ b/atuin-client/src/database.rs @@ -17,13 +17,14 @@ use sqlx::{ use super::{ history::History, ordering, - settings::{FilterMode, SearchMode}, + settings::{FilterMode, SearchMode, Settings}, }; pub struct Context { pub session: String, pub cwd: String, pub hostname: String, + pub host_id: String, } #[derive(Default, Clone)] @@ -50,11 +51,13 @@ pub fn current_context() -> Context { env::var("ATUIN_HOST_USER").unwrap_or_else(|_| whoami::username()) ); let cwd = utils::get_current_dir(); + let host_id = Settings::host_id().expect("failed to load host ID"); Context { session, hostname, cwd, + host_id, } } @@ -551,6 +554,7 @@ mod test { hostname: "test:host".to_string(), session: "beepboopiamasession".to_string(), cwd: "/home/ellie".to_string(), + host_id: "test-host".to_string(), }; let results = db @@ -757,6 +761,7 @@ mod test { hostname: "test:host".to_string(), session: "beepboopiamasession".to_string(), cwd: "/home/ellie".to_string(), + host_id: "test-host".to_string(), }; let mut db = Sqlite::new("sqlite::memory:").await.unwrap(); |
