@@ -8,12 +8,13 @@ pub use threads::Threads;
88
99use crate :: { bytes_format:: BytesFormat , visualizer:: ColumnWidthDistribution } ;
1010use clap:: { ColorChoice , Parser } ;
11+ use smart_default:: SmartDefault ;
1112use std:: { num:: NonZeroU64 , path:: PathBuf } ;
1213use terminal_size:: { terminal_size, Width } ;
1314use 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]
8082pub 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