@@ -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 /// Print the tree top-down instead of bottom-up.
@@ -103,10 +106,12 @@ pub struct Args {
103106
104107 /// Aspect of the files/directories to be measured.
105108 #[ clap( long, value_enum, default_value_t = Quantity :: DEFAULT ) ]
109+ #[ default( Quantity :: DEFAULT ) ]
106110 pub quantity : Quantity ,
107111
108112 /// Maximum depth to display the data (must be greater than 0).
109113 #[ clap( long, default_value = "10" ) ]
114+ #[ default( _code = "10.try_into().unwrap()" ) ]
110115 pub max_depth : NonZeroU64 ,
111116
112117 /// Width of the visualization.
0 commit comments