mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
feat: default option for depth from config file
- If `--depth` flag is not defined (or it has an invalid value), a value from the config file will be used. - If no `depth` entry in the config file (or there is no config file), the default `usize::MAX` will be used. Added test cases: - no config and no flag defined -> `usize::MAX` should be used - config defined, but flag is not defined -> config value should be used - config is not defined, but flag is defined -> flag value should be used - both config and flag is defined -> flag value should be used Additional changes: - Fixed some clippy issues. - Added comments to the example `config.toml` file. (copy from flag description) Closes: #314 Signed-off-by: Balazs Nadasdi <efertone@pm.me>
This commit is contained in:
+1
-1
@@ -130,7 +130,7 @@ fn main() {
|
||||
.value_of_t("width")
|
||||
.unwrap_or_else(|_| get_width_of_terminal());
|
||||
|
||||
let depth = options.value_of_t("depth").unwrap_or(usize::MAX);
|
||||
let depth = config.get_depth(&options);
|
||||
|
||||
// If depth is set, then we set the default number_of_lines to be max
|
||||
// instead of screen height
|
||||
|
||||
Reference in New Issue
Block a user