File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -99,15 +99,27 @@ mod logging {
9999pub struct CliOptions {
100100 /// The desired version of clang to install.
101101 #[ arg(
102- short,
103- long,
104- default_missing_value = "CPP-LINTER-VERSION" ,
105- num_args = 0 ..=1 ,
106- value_parser = RequestedVersion :: from_str,
107- default_value = "" ,
102+ short,
103+ long,
104+ default_missing_value = "CPP-LINTER-VERSION" ,
105+ num_args = 0 ..=1 ,
106+ value_parser = RequestedVersion :: from_str,
107+ default_value = "" ,
108108 ) ]
109109 pub version : Option < RequestedVersion > ,
110110
111+ /// Enable verbose logging for debugging purposes.
112+ ///
113+ /// This will include more DEBUG level log messages.
114+ /// Without it, log level is set to INFO by default.
115+ #[ arg(
116+ short = 'V' ,
117+ long,
118+ default_value_t = false ,
119+ action = clap:: ArgAction :: SetTrue ,
120+ ) ]
121+ pub verbose : bool ,
122+
111123 /// The clang tool to install.
112124 #[ arg(
113125 short,
@@ -132,7 +144,9 @@ pub struct CliOptions {
132144async fn main ( ) -> Result < ( ) > {
133145 logging:: initialize_logger ( ) ;
134146 let options = CliOptions :: parse ( ) ;
135-
147+ if options. verbose {
148+ log:: set_max_level ( log:: LevelFilter :: Debug ) ;
149+ }
136150 let tool = options
137151 . tool
138152 . expect ( "--tool should have a default value: [clang-format, clang-tidy]" ) ;
You can’t perform that action at this time.
0 commit comments