mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-23 13:45:12 +02:00
Update documentation again, also change temp a bit
This commit is contained in:
parent
48107ac526
commit
238e0c88e0
11
README.md
11
README.md
@ -92,7 +92,16 @@ Run using `btm`.
|
|||||||
|
|
||||||
- `-R`, `--regex` will default to using regex.
|
- `-R`, `--regex` will default to using regex.
|
||||||
|
|
||||||
- `-C`, `--config` takes in a file path leading to a TOML file, where one can set flags by default. The default path this will check is, on Linux, `~/.config/btm/btm.toml`. Options are the same as the long names as other flags (ie: `regex = true`). See the [sample config](./sample_config.toml) for an example.
|
- `-C`, `--config` takes in a file path leading to a TOML file, where one can set flags to execute by default.
|
||||||
|
|
||||||
|
- Options are generally the same as the long names as other flags (ie: `case_sensitive = true`).
|
||||||
|
- For temperature type, use `temperature_type = <kelvin|k|celsius|c|fahrenheit|f>`.
|
||||||
|
- See the [sample config](./sample_config.toml) for an example.
|
||||||
|
|
||||||
|
bottom will check specific locations by default for a config file.
|
||||||
|
|
||||||
|
- For Unix-based systems: `~/.config/btm/btm.toml`.
|
||||||
|
- For Windows: TBD.
|
||||||
|
|
||||||
### Keybindings
|
### Keybindings
|
||||||
|
|
||||||
|
@ -6,8 +6,7 @@ pub const MAX_KEY_TIMEOUT_IN_MILLISECONDS: u128 = 1000;
|
|||||||
pub const NUM_COLOURS: i32 = 256;
|
pub const NUM_COLOURS: i32 = 256;
|
||||||
|
|
||||||
// Config and flags
|
// Config and flags
|
||||||
pub const DEFAULT_CONFIG_FILE_PATH: &str = "~/.config/btm/btm.toml";
|
pub const DEFAULT_UNIX_CONFIG_FILE_PATH: &str = "~/.config/btm/btm.toml";
|
||||||
|
|
||||||
pub const KELVIN: &str = "kelvin";
|
// TODO: [CONF] Default windows path?
|
||||||
pub const FAHRENHEIT: &str = "fahrenheit";
|
pub const DEFAULT_WINDOWS_CONFIG_FILE_PATH: &str = "";
|
||||||
pub const CELSIUS: &str = "celsius";
|
|
||||||
|
18
src/main.rs
18
src/main.rs
@ -99,11 +99,13 @@ fn main() -> error::Result<()> {
|
|||||||
utils::logging::init_logger()?;
|
utils::logging::init_logger()?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let config_path = std::path::Path::new(
|
let config_path = std::path::Path::new(matches.value_of("CONFIG_LOCATION").unwrap_or(
|
||||||
matches
|
if cfg!(target_os = "windows") {
|
||||||
.value_of("CONFIG_LOCATION")
|
DEFAULT_WINDOWS_CONFIG_FILE_PATH
|
||||||
.unwrap_or(DEFAULT_CONFIG_FILE_PATH),
|
} else {
|
||||||
);
|
DEFAULT_UNIX_CONFIG_FILE_PATH
|
||||||
|
},
|
||||||
|
));
|
||||||
|
|
||||||
let config_string = std::fs::read_to_string(config_path);
|
let config_string = std::fs::read_to_string(config_path);
|
||||||
let config_toml: Config = if let Ok(config_str) = config_string {
|
let config_toml: Config = if let Ok(config_str) = config_string {
|
||||||
@ -143,9 +145,9 @@ fn main() -> error::Result<()> {
|
|||||||
} else if let Some(temp_type) = config_toml.temperature_type {
|
} else if let Some(temp_type) = config_toml.temperature_type {
|
||||||
// Give lowest priority to config.
|
// Give lowest priority to config.
|
||||||
match temp_type.as_str() {
|
match temp_type.as_str() {
|
||||||
constants::FAHRENHEIT => data_harvester::temperature::TemperatureType::Fahrenheit,
|
"fahrenheit" | "f" => data_harvester::temperature::TemperatureType::Fahrenheit,
|
||||||
constants::KELVIN => data_harvester::temperature::TemperatureType::Kelvin,
|
"kelvin" | "k" => data_harvester::temperature::TemperatureType::Kelvin,
|
||||||
constants::CELSIUS => data_harvester::temperature::TemperatureType::Celsius,
|
"celsius" | "c" => data_harvester::temperature::TemperatureType::Celsius,
|
||||||
_ => data_harvester::temperature::TemperatureType::Celsius,
|
_ => data_harvester::temperature::TemperatureType::Celsius,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user