chore: Cleanup threads commit

This commit is contained in:
andy.boot
2024-05-06 20:09:01 +01:00
parent 5b87260467
commit e78690e4f5
4 changed files with 28 additions and 27 deletions
+9
View File
@@ -29,6 +29,7 @@ pub struct Config {
pub depth: Option<usize>,
pub bars_on_right: Option<bool>,
pub stack_size: Option<usize>,
pub threads: Option<usize>,
pub output_json: Option<bool>,
}
@@ -118,6 +119,14 @@ impl Config {
from_cmd_line.copied()
}
}
pub fn get_threads(&self, options: &ArgMatches) -> Option<usize> {
let from_cmd_line = options.get_one::<usize>("threads");
if from_cmd_line.is_none() {
self.threads
} else {
from_cmd_line.copied()
}
}
pub fn get_output_json(&self, options: &ArgMatches) -> bool {
Some(true) == self.output_json || options.get_flag("output_json")
}