mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
remove depth from config.toml and fix style issues
Signed-off-by: Efertone <efertone@pm.me>
This commit is contained in:
@@ -26,6 +26,3 @@ ignore-hidden=true
|
|||||||
|
|
||||||
# print sizes in powers of 1000 (e.g., 1.1G)
|
# print sizes in powers of 1000 (e.g., 1.1G)
|
||||||
iso=true
|
iso=true
|
||||||
|
|
||||||
# Depth to show
|
|
||||||
depth=1
|
|
||||||
|
|||||||
+4
-4
@@ -63,7 +63,7 @@ impl Config {
|
|||||||
pub fn get_depth(&self, options: &ArgMatches) -> usize {
|
pub fn get_depth(&self, options: &ArgMatches) -> usize {
|
||||||
if let Some(v) = options.value_of("depth") {
|
if let Some(v) = options.value_of("depth") {
|
||||||
if let Ok(v) = v.parse::<usize>() {
|
if let Ok(v) = v.parse::<usize>() {
|
||||||
return v
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ pub fn get_config() -> Config {
|
|||||||
mod tests {
|
mod tests {
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use super::*;
|
use super::*;
|
||||||
use clap::{Command, Arg, ArgMatches};
|
use clap::{Arg, ArgMatches, Command};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_conversion() {
|
fn test_conversion() {
|
||||||
@@ -190,7 +190,7 @@ mod tests {
|
|||||||
assert_eq!(c.get_depth(&args), 5);
|
assert_eq!(c.get_depth(&args), 5);
|
||||||
|
|
||||||
// Config is defined and flag is not defined.
|
// Config is defined and flag is not defined.
|
||||||
let c = Config{
|
let c = Config {
|
||||||
depth: Some(3),
|
depth: Some(3),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
@@ -198,7 +198,7 @@ mod tests {
|
|||||||
assert_eq!(c.get_depth(&args), 3);
|
assert_eq!(c.get_depth(&args), 3);
|
||||||
|
|
||||||
// Both config and flag are defined.
|
// Both config and flag are defined.
|
||||||
let c = Config{
|
let c = Config {
|
||||||
depth: Some(3),
|
depth: Some(3),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user