Skip to content

Commit 10ca624

Browse files
committed
chore(git): merge from master
2 parents 369eb57 + 5007d31 commit 10ca624

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/args.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ pub use threads::Threads;
88

99
use crate::{bytes_format::BytesFormat, visualizer::ColumnWidthDistribution};
1010
use clap::{ColorChoice, Parser};
11+
use smart_default::SmartDefault;
1112
use std::{num::NonZeroU64, path::PathBuf};
1213
use terminal_size::{terminal_size, Width};
1314
use text_block_macros::text_block;
1415

1516
/// The CLI arguments.
16-
#[derive(Debug, Clone, Parser)]
17+
#[derive(Debug, SmartDefault, Clone, Parser)]
1718
#[clap(
1819
name = "pdu",
1920
@@ -77,6 +78,7 @@ use text_block_macros::text_block;
7778
7879
color = ColorChoice::Never,
7980
)]
81+
#[non_exhaustive]
8082
pub struct Args {
8183
/// List of files and/or directories.
8284
pub files: Vec<PathBuf>,
@@ -91,6 +93,7 @@ pub struct Args {
9193

9294
/// How to display the numbers of bytes.
9395
#[clap(long, value_enum, default_value_t = BytesFormat::MetricUnits)]
96+
#[default(BytesFormat::MetricUnits)]
9497
pub bytes_format: BytesFormat,
9598

9699
/// Detect duplicated hardlinks and remove their sizes from total.
@@ -108,10 +111,12 @@ pub struct Args {
108111

109112
/// Aspect of the files/directories to be measured.
110113
#[clap(long, value_enum, default_value_t = Quantity::DEFAULT)]
114+
#[default(Quantity::DEFAULT)]
111115
pub quantity: Quantity,
112116

113117
/// Maximum depth to display the data (must be greater than 0).
114118
#[clap(long, default_value = "10")]
119+
#[default(_code = "10.try_into().unwrap()")]
115120
pub max_depth: NonZeroU64,
116121

117122
/// Width of the visualization.

0 commit comments

Comments
 (0)