diff options
author | Conrad Ludgate <conradludgate@gmail.com> | 2021-11-21 10:29:38 +0000 |
---|---|---|
committer | Conrad Ludgate <conradludgate@gmail.com> | 2021-11-21 10:29:38 +0000 |
commit | f1deca0a944d50de344043aaed6d8347cadf878b (patch) | |
tree | 55df878ba0828b51481f6327ad8238e731407e4d | |
parent | f2c1922e481b49fc169cd9dce3709c9798f22f6a (diff) |
chore: test using new config changes
-rw-r--r-- | atuin-client/Cargo.toml | 2 | ||||
-rw-r--r-- | atuin-client/src/settings.rs | 8 | ||||
-rw-r--r-- | atuin-server/Cargo.toml | 2 | ||||
-rw-r--r-- | atuin-server/src/settings.rs | 2 | ||||
-rw-r--r-- | src/command/history.rs | 3 |
5 files changed, 9 insertions, 8 deletions
diff --git a/atuin-client/Cargo.toml b/atuin-client/Cargo.toml index e0e50ac1..292db683 100644 --- a/atuin-client/Cargo.toml +++ b/atuin-client/Cargo.toml @@ -22,7 +22,7 @@ uuid = { version = "0.8", features = ["v4"] } indicatif = "0.16.2" whoami = "1.1.2" chrono-english = "0.1.4" -config = "0.11" +config = { git = "https://github.com/conradludgate/config-rs", branch = "absolute-path-current-dir" } serde_derive = "1.0.125" serde = "1.0.126" serde_json = "1.0.64" diff --git a/atuin-client/src/settings.rs b/atuin-client/src/settings.rs index 8793b73e..cc16e92b 100644 --- a/atuin-client/src/settings.rs +++ b/atuin-client/src/settings.rs @@ -120,7 +120,7 @@ impl Settings { config_file.push("config.toml"); - let mut s = Config::new(); + let mut s = Config::default(); let db_path = data_dir.join("history.db"); let key_path = data_dir.join("key"); @@ -149,15 +149,15 @@ impl Settings { .wrap_err("could not load environment")?; // all paths should be expanded - let db_path = s.get_str("db_path")?; + let db_path = s.get_string("db_path")?; let db_path = shellexpand::full(db_path.as_str())?; s.set("db_path", db_path.to_string())?; - let key_path = s.get_str("key_path")?; + let key_path = s.get_string("key_path")?; let key_path = shellexpand::full(key_path.as_str())?; s.set("key_path", key_path.to_string())?; - let session_path = s.get_str("session_path")?; + let session_path = s.get_string("session_path")?; let session_path = shellexpand::full(session_path.as_str())?; s.set("session_path", session_path.to_string())?; diff --git a/atuin-server/Cargo.toml b/atuin-server/Cargo.toml index 579321dd..a99210fc 100644 --- a/atuin-server/Cargo.toml +++ b/atuin-server/Cargo.toml @@ -20,7 +20,7 @@ uuid = { version = "0.8", features = ["v4"] } indicatif = "0.16.2" whoami = "1.1.2" chrono-english = "0.1.4" -config = "0.11" +config = { git = "https://github.com/conradludgate/config-rs", branch = "absolute-path-current-dir" } serde_derive = "1.0.125" serde = "1.0.126" serde_json = "1.0.64" diff --git a/atuin-server/src/settings.rs b/atuin-server/src/settings.rs index 7364656e..df1d7e35 100644 --- a/atuin-server/src/settings.rs +++ b/atuin-server/src/settings.rs @@ -34,7 +34,7 @@ impl Settings { // create the config file if it does not exist - let mut s = Config::new(); + let mut s = Config::default(); if config_file.exists() { s.merge(ConfigFile::with_name(config_file.to_str().unwrap()))?; diff --git a/src/command/history.rs b/src/command/history.rs index 4606b304..c7bc3bb2 100644 --- a/src/command/history.rs +++ b/src/command/history.rs @@ -114,7 +114,8 @@ impl Cmd { return Ok(()); } - let cwd = env::current_dir()?.display().to_string(); + let cwd = env::current_dir() + .map_or_else(|_| String::new(), |cwd| cwd.display().to_string()); let h = History::new(chrono::Utc::now(), command, cwd, -1, -1, None, None); |