@@ -255,7 +255,8 @@ pub fn build_app() -> Command {
255
255
. long_help (
256
256
"Sets the location of the config file. Expects a config file in the TOML format. \
257
257
If it doesn't exist, one is created.",
258
- ) ;
258
+ )
259
+ . value_hint ( ValueHint :: AnyPath ) ;
259
260
260
261
// TODO: File an issue with manpage, it cannot render charts correctly.
261
262
let color = Arg :: new ( "color" )
@@ -270,29 +271,7 @@ pub fn build_app() -> Command {
270
271
"nord" ,
271
272
"nord-light" ,
272
273
] ) )
273
- . hide_possible_values ( true )
274
- . help ( "Use a color scheme, use --help for info." )
275
- . long_help (
276
- "\
277
- Use a pre-defined color scheme. Currently supported values are:
278
-
279
- +------------------------------------------------------------+
280
- | default |
281
- +------------------------------------------------------------+
282
- | default-light (default but for use with light backgrounds) |
283
- +------------------------------------------------------------+
284
- | gruvbox (a bright theme with 'retro groove' colors) |
285
- +------------------------------------------------------------+
286
- | gruvbox-light (gruvbox but for use with light backgrounds) |
287
- +------------------------------------------------------------+
288
- | nord (an arctic, north-bluish color palette) |
289
- +------------------------------------------------------------+
290
- | nord-light (nord but for use with light backgrounds) |
291
- +------------------------------------------------------------+
292
-
293
- Defaults to \" default\" .
294
- " ,
295
- ) ;
274
+ . help ( "Use a pre-defined color scheme." ) ;
296
275
297
276
let mem_as_value = Arg :: new ( "mem_as_value" )
298
277
. long ( "mem_as_value" )
@@ -410,84 +389,93 @@ use CPU (3) as the default instead.
410
389
None => crate_version ! ( ) ,
411
390
} ;
412
391
413
- #[ allow( unused_mut) ]
414
- let mut app = Command :: new ( crate_name ! ( ) )
392
+ let temperature_group = ArgGroup :: new ( "TEMPERATURE_TYPE" ) . args ( [
393
+ kelvin. get_id ( ) ,
394
+ fahrenheit. get_id ( ) ,
395
+ celsius. get_id ( ) ,
396
+ ] ) ;
397
+
398
+ let mut args = [
399
+ version,
400
+ kelvin,
401
+ fahrenheit,
402
+ celsius,
403
+ autohide_time,
404
+ basic,
405
+ case_sensitive,
406
+ process_command,
407
+ config_location,
408
+ color,
409
+ mem_as_value,
410
+ default_time_value,
411
+ default_widget_count,
412
+ default_widget_type,
413
+ disable_click,
414
+ dot_marker,
415
+ group,
416
+ hide_avg_cpu,
417
+ hide_table_gap,
418
+ hide_time,
419
+ show_table_scroll_position,
420
+ left_legend,
421
+ disable_advanced_kill,
422
+ rate,
423
+ regex,
424
+ time_delta,
425
+ tree,
426
+ network_use_bytes,
427
+ network_use_log,
428
+ network_use_binary_prefix,
429
+ current_usage,
430
+ unnormalized_cpu,
431
+ use_old_network_legend,
432
+ whole_word,
433
+ retention,
434
+ expanded_on_startup,
435
+ #[ cfg( feature = "battery" ) ]
436
+ {
437
+ Arg :: new ( "battery" )
438
+ . long ( "battery" )
439
+ . action ( ArgAction :: SetTrue )
440
+ . help ( "Shows the battery widget." )
441
+ . long_help (
442
+ "Shows the battery widget in default or basic mode. No effect on custom layouts." ,
443
+ )
444
+ } ,
445
+ #[ cfg( feature = "gpu" ) ]
446
+ {
447
+ Arg :: new ( "enable_gpu_memory" )
448
+ . long ( "enable_gpu_memory" )
449
+ . action ( ArgAction :: SetTrue )
450
+ . help ( "Enable collecting and displaying GPU memory usage." )
451
+ } ,
452
+ #[ cfg( not( target_os = "windows" ) ) ]
453
+ {
454
+ Arg :: new ( "enable_cache_memory" )
455
+ . long ( "enable_cache_memory" )
456
+ . action ( ArgAction :: SetTrue )
457
+ . help ( "Enable collecting and displaying cache and buffer memory." )
458
+ } ,
459
+ ] ;
460
+
461
+ // Manually sort the arguments.
462
+ args. sort_by ( |a, b| {
463
+ let a = a. get_long ( ) . unwrap_or ( a. get_id ( ) . as_str ( ) ) ;
464
+ let b = b. get_long ( ) . unwrap_or ( b. get_id ( ) . as_str ( ) ) ;
465
+
466
+ a. cmp ( b)
467
+ } ) ;
468
+
469
+ Command :: new ( crate_name ! ( ) )
415
470
. version ( VERSION )
416
471
. author ( crate_authors ! ( ) )
417
472
. about ( crate_description ! ( ) )
418
473
. color ( ColorChoice :: Auto )
419
474
. override_usage ( USAGE )
420
475
. help_template ( TEMPLATE )
421
476
. disable_version_flag ( true )
422
- . arg ( version)
423
- . arg ( kelvin)
424
- . arg ( fahrenheit)
425
- . arg ( celsius)
426
- . group ( ArgGroup :: new ( "TEMPERATURE_TYPE" ) . args ( [ "kelvin" , "fahrenheit" , "celsius" ] ) )
427
- . arg ( autohide_time)
428
- . arg ( basic)
429
- . arg ( case_sensitive)
430
- . arg ( process_command)
431
- . arg ( config_location)
432
- . arg ( color)
433
- . arg ( mem_as_value)
434
- . arg ( default_time_value)
435
- . arg ( default_widget_count)
436
- . arg ( default_widget_type)
437
- . arg ( disable_click)
438
- . arg ( dot_marker)
439
- . arg ( group)
440
- . arg ( hide_avg_cpu)
441
- . arg ( hide_table_gap)
442
- . arg ( hide_time)
443
- . arg ( show_table_scroll_position)
444
- . arg ( left_legend)
445
- . arg ( disable_advanced_kill)
446
- . arg ( rate)
447
- . arg ( regex)
448
- . arg ( time_delta)
449
- . arg ( tree)
450
- . arg ( network_use_bytes)
451
- . arg ( network_use_log)
452
- . arg ( network_use_binary_prefix)
453
- . arg ( current_usage)
454
- . arg ( unnormalized_cpu)
455
- . arg ( use_old_network_legend)
456
- . arg ( whole_word)
457
- . arg ( retention)
458
- . arg ( expanded_on_startup) ;
459
-
460
- #[ cfg( feature = "battery" ) ]
461
- {
462
- let battery = Arg :: new ( "battery" )
463
- . long ( "battery" )
464
- . action ( ArgAction :: SetTrue )
465
- . help ( "Shows the battery widget." )
466
- . long_help (
467
- "Shows the battery widget in default or basic mode. No effect on custom layouts." ,
468
- ) ;
469
- app = app. arg ( battery) ;
470
- }
471
-
472
- #[ cfg( feature = "gpu" ) ]
473
- {
474
- let enable_gpu_memory = Arg :: new ( "enable_gpu_memory" )
475
- . long ( "enable_gpu_memory" )
476
- . action ( ArgAction :: SetTrue )
477
- . help ( "Enable collecting and displaying GPU memory usage." ) ;
478
- app = app. arg ( enable_gpu_memory) ;
479
- }
480
-
481
- #[ cfg( not( target_os = "windows" ) ) ]
482
- {
483
- let cache = Arg :: new ( "enable_cache_memory" )
484
- . long ( "enable_cache_memory" )
485
- . action ( ArgAction :: SetTrue )
486
- . help ( "Enable collecting and displaying cache and buffer memory." ) ;
487
- app = app. arg ( cache) ;
488
- }
489
-
490
- app
477
+ . args ( args)
478
+ . group ( temperature_group)
491
479
}
492
480
493
481
#[ cfg( test) ]
0 commit comments