0.2.2 |
|
---|---|
0.2.1 |
|
0.2.0 |
|
0.1.1 |
|
0.1.0 |
|
#5 in #dirs
11KB
175 lines
kettle
A library for building applications natively on Linux/Redox/macOS/Windows. It currently provides...
- app-specific
dirs
- easy
ini
config files
This crate utilizes the dirs
crate and re-exports it for easy access.
Usage
pub(crate) const THIS_APP: kettle::App = kettle::app("this_APP", None);
fn main() {
let config_dir = THIS_APP.config_dir(); //$HOME/.config/this_APP/
let data_dir = THIS_APP.data_dir(); //$HOME/.local/share/this_APP/
// default config file
THIS_APP.config()
.set("view", Some("horizontal"));
let view = THIS_APP.config()
.get("view");
assert_eq!(view.unwrap(), Some("horizontal".to_string()));
// named config file
THIS_APP.config_file("admin_profiles")
.section("dev") // setting `ini` sections is possible
.set("view", None);
let admin_view = THIS_APP.config_file("admin_profiles")
.section("dev");
.get("view");
assert_eq!(admin_view.unwrap(), None);
}
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Dependencies
~1.8–2.7MB
~48K SLoC