@@ -37,6 +37,8 @@ pub struct CliOptions {
37
37
#[ command( flatten) ]
38
38
pub visuals : VisualsCliOptions ,
39
39
#[ command( flatten) ]
40
+ pub config : ConfigCliOptions ,
41
+ #[ command( flatten) ]
40
42
pub developer : DeveloperCliOptions ,
41
43
#[ command( flatten) ]
42
44
pub other : OtherCliOptions ,
@@ -213,6 +215,18 @@ pub struct VisualsCliOptions {
213
215
pub nerd_fonts : bool ,
214
216
}
215
217
218
+ #[ derive( Clone , Debug , Args , PartialEq , Eq ) ]
219
+ #[ command( next_help_heading = "CONFIG" ) ]
220
+ pub struct ConfigCliOptions {
221
+ /// Path to the config file
222
+ #[ arg( long, value_hint = ValueHint :: FilePath ) ]
223
+ pub config_path : Option < PathBuf > ,
224
+ /// Creates a default config file
225
+ /// Writes to $XDG_CONFIG_HOME/onefetch/config.toml but can be overridden with --config-path
226
+ #[ arg( long) ]
227
+ pub generate_config : bool ,
228
+ }
229
+
216
230
#[ derive( Clone , Debug , Args , PartialEq , Eq , Default ) ]
217
231
#[ command( next_help_heading = "DEVELOPER" ) ]
218
232
pub struct DeveloperCliOptions {
@@ -244,6 +258,7 @@ impl Default for CliOptions {
244
258
visuals : VisualsCliOptions :: default ( ) ,
245
259
ascii : AsciiCliOptions :: default ( ) ,
246
260
image : ImageCliOptions :: default ( ) ,
261
+ config : ConfigCliOptions :: default ( ) ,
247
262
developer : DeveloperCliOptions :: default ( ) ,
248
263
other : OtherCliOptions :: default ( ) ,
249
264
}
@@ -302,6 +317,20 @@ impl Default for ImageCliOptions {
302
317
}
303
318
}
304
319
320
+ impl Default for ConfigCliOptions {
321
+ fn default ( ) -> Self {
322
+ ConfigCliOptions {
323
+ // Not sure about unwrap
324
+ config_path : Some (
325
+ dirs:: config_dir ( )
326
+ . expect ( "Could not find $HOME!" )
327
+ . join ( "onefetch/config.toml" ) ,
328
+ ) ,
329
+ generate_config : false ,
330
+ }
331
+ }
332
+ }
333
+
305
334
pub fn print_supported_languages ( ) -> Result < ( ) > {
306
335
for l in Language :: iter ( ) {
307
336
println ! ( "{l}" ) ;
0 commit comments