diff options
author | ClementTsang <cjhtsang@uwaterloo.ca> | 2020-04-27 13:48:56 -0400 |
---|---|---|
committer | ClementTsang <cjhtsang@uwaterloo.ca> | 2020-04-27 13:48:56 -0400 |
commit | 8534d42f1be01cf8da8176036112a9405bd03217 (patch) | |
tree | e0cf76a5623cea99fbaf46cf8872f04ca66ec305 /src/options.rs | |
parent | 3d6ebc515237e2440d709319cc39769cd673ec6f (diff) |
refactor: separate state to different file
Diffstat (limited to 'src/options.rs')
-rw-r--r-- | src/options.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/options.rs b/src/options.rs index b879d9ca..7351f4c4 100644 --- a/src/options.rs +++ b/src/options.rs @@ -42,6 +42,7 @@ pub struct ConfigFlags { pub default_widget_count: Option<u64>, pub use_old_network_legend: Option<bool>, pub hide_table_gap: Option<bool>, + pub battery: Option<bool>, } #[derive(Default, Deserialize)] @@ -636,3 +637,16 @@ pub fn get_hide_table_gap(matches: &clap::ArgMatches<'static>, config: &Config) } false } + +pub fn get_use_battery(matches: &clap::ArgMatches<'static>, config: &Config) -> bool { + if matches.is_present("BATTERY") { + return true; + } else if let Some(flags) = &config.flags { + if let Some(battery) = flags.battery { + if battery { + return true; + } + } + } + false +} |