Skip to content

Commit

Permalink
new: added support for toml and json config formats (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
pamburus authored Jun 10, 2024
1 parent 2a189da commit 1d71b44
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ members = [".", "crate/encstr"]
[workspace.package]
repository = "https://github.com/pamburus/hl"
authors = ["Pavel Ivanov <mr.pavel.ivanov@gmail.com>"]
version = "0.29.7-alpha.3"
version = "0.29.7-alpha.4"
edition = "2021"
license = "MIT"

Expand All @@ -31,11 +31,7 @@ sha2 = "0"
bincode = "1"
bytefmt = "0"
capnp = "0.19"
chrono = { version = "0.4", default-features = false, features = [
"clock",
"serde",
"std",
] }
chrono = { version = "0.4", default-features = false, features = ["clock", "serde", "std"] }
chrono-tz = { version = "0", features = ["serde"] }
clap = { version = "4", features = ["wrap_help", "derive", "env", "string"] }
clap_complete = "4"
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,11 @@ See other [screenshots](https://github.com/pamburus/hl-extra/tree/90be58af2fb91d

- Configuration file is automatically loaded if found in a predefined platform-specific location.

| OS | Location |
| ------- | --------------------------------------------- |
| macOS | ~/.config/hl/config.yaml |
| Linux | ~/.config/hl/config.yaml |
| Windows | %USERPROFILE%\AppData\Roaming\hl\config.yaml |
| OS | Location |
| ------- | --------------------------------------------------------- |
| macOS | ~/.config/hl/config.{yaml,toml,json} |
| Linux | ~/.config/hl/config.{yaml,toml,json} |
| Windows | %USERPROFILE%\AppData\Roaming\hl\config.{yaml,toml,json} |

- The path to the configuration file can be overridden using the HL_CONFIG environment variable.

Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn load(path: Option<&str>) -> Result<Settings> {
let (filename, required) = path.map(|p| (p, true)).unwrap_or_else(|| {
(
if let Some(dirs) = app_dirs() {
default = Some(dirs.config_dir.join("config.yaml").to_string_lossy().to_string());
default = Some(dirs.config_dir.join("config").to_string_lossy().to_string());
default.as_deref().unwrap()
} else {
""
Expand Down

0 comments on commit 1d71b44

Please sign in to comment.