@@ -3,7 +3,7 @@ use crate::info::langs::language::{Language, LanguageType};
33use crate :: info:: utils:: info_field:: InfoType ;
44use crate :: ui:: printer:: SerializationFormat ;
55use anyhow:: Result ;
6- use clap:: builder:: PossibleValuesParser ;
6+ use clap:: builder:: { PossibleValuesParser , Styles } ;
77use clap:: builder:: TypedValueParser as _;
88use clap:: { value_parser, Args , Command , Parser , ValueHint } ;
99use clap_complete:: { generate, Generator , Shell } ;
@@ -22,15 +22,48 @@ const COLOR_RESOLUTIONS: [&str; 5] = ["16", "32", "64", "128", "256"];
2222pub const NO_BOTS_DEFAULT_REGEX_PATTERN : & str = r"(?:-|\s)[Bb]ot$|\[[Bb]ot\]" ;
2323
2424#[ derive( Clone , Debug , Parser , PartialEq , Eq ) ]
25- #[ command( version, about) ]
25+ #[ command(
26+ about = tr!( "cli-about" ) ,
27+ version,
28+ disable_help_flag = true ,
29+ disable_version_flag = true ,
30+ help_template = format!( "\
31+ {{before-help}}{{about-with-newline}}\
32+ \n {}{}:{} {{usage}}
33+ \n {{all-args}}{{after-help}}\
34+ ",
35+ Styles :: default ( ) . get_usage( ) . render( ) ,
36+ tr!( "cli-usage-header" ) ,
37+ Styles :: default ( ) . get_usage( ) . render_reset( )
38+ ) ,
39+ next_help_heading = tr!( "cli-arguments-header" ) ,
40+ override_usage = format!( "onefetch [{}] [{}]" , tr!( "cli-options-header" ) . to_owned( ) . to_uppercase( ) , tr!( "cli-value-input" ) )
41+ ) ]
2642pub struct CliOptions {
2743 #[ arg(
2844 default_value = "." ,
2945 hide_default_value = true ,
3046 value_hint = ValueHint :: DirPath ,
31- help = tr!( "cli-input" )
47+ help = tr!( "cli-input" ) ,
48+ value_name = tr!( "cli-value-input" )
3249 ) ]
3350 pub input : PathBuf ,
51+ #[ arg(
52+ action = clap:: ArgAction :: Help ,
53+ long,
54+ short,
55+ help = tr!( "cli-help" ) ,
56+ help_heading = tr!( "cli-options-header" )
57+ ) ]
58+ pub help : Option < bool > ,
59+ #[ arg(
60+ action = clap:: ArgAction :: Version ,
61+ long,
62+ short = 'V' ,
63+ help = tr!( "cli-version" ) ,
64+ help_heading = tr!( "cli-options-header" )
65+ ) ]
66+ pub version : Option < bool > ,
3467 #[ command( flatten) ]
3568 pub info : InfoCliOptions ,
3669 #[ command( flatten) ]
@@ -203,6 +236,8 @@ pub struct OtherCliOptions {
203236impl Default for CliOptions {
204237 fn default ( ) -> CliOptions {
205238 CliOptions {
239+ help : None ,
240+ version : None ,
206241 input : PathBuf :: from ( "." ) ,
207242 info : InfoCliOptions :: default ( ) ,
208243 text_formatting : TextForamttingCliOptions :: default ( ) ,
0 commit comments