1+ use crate :: i18n:: tr;
12use crate :: info:: langs:: language:: { Language , LanguageType } ;
23use crate :: info:: utils:: info_field:: InfoType ;
34use crate :: ui:: printer:: SerializationFormat ;
@@ -9,7 +10,6 @@ use clap_complete::{generate, Generator, Shell};
910use num_format:: CustomFormat ;
1011use onefetch_image:: ImageProtocol ;
1112use onefetch_manifest:: ManifestType ;
12- use crate :: i18n:: tr;
1313use regex:: Regex ;
1414use serde:: Serialize ;
1515use std:: env;
@@ -24,8 +24,12 @@ pub const NO_BOTS_DEFAULT_REGEX_PATTERN: &str = r"(?:-|\s)[Bb]ot$|\[[Bb]ot\]";
2424#[ derive( Clone , Debug , Parser , PartialEq , Eq ) ]
2525#[ command( version, about) ]
2626pub struct CliOptions {
27- #[ arg( help = tr!( "cli-input" ) ) ]
28- #[ arg( default_value = "." , hide_default_value = true , value_hint = ValueHint :: DirPath ) ]
27+ #[ arg(
28+ default_value = "." ,
29+ hide_default_value = true ,
30+ value_hint = ValueHint :: DirPath ,
31+ help = tr!( "cli-input" )
32+ ) ]
2933 pub input : PathBuf ,
3034 #[ command( flatten) ]
3135 pub info : InfoCliOptions ,
@@ -44,70 +48,56 @@ pub struct CliOptions {
4448}
4549
4650#[ derive( Clone , Debug , Args , PartialEq , Eq ) ]
47- #[ command( next_help_heading = "INFO" ) ]
51+ #[ command( next_help_heading = tr! ( "cli-info-heading" ) ) ]
4852pub struct InfoCliOptions {
49- /// Allows you to disable FIELD(s) from appearing in the output
5053 #[ arg(
5154 long,
5255 short,
56+ help = tr!( "cli-info-disabled-fields" ) ,
5357 num_args = 1 ..,
5458 hide_possible_values = true ,
5559 value_enum,
56- value_name = "FIELD"
60+ value_name = tr! ( "cli-value-field" )
5761 ) ]
5862 pub disabled_fields : Vec < InfoType > ,
59- /// Hides the title
60- #[ arg( long) ]
63+ #[ arg( long, help = tr!( "cli-info-no-title" ) ) ]
6164 pub no_title : bool ,
62- /// Maximum NUM of authors to be shown
63- #[ arg( long, default_value_t = 3usize , value_name = "NUM" ) ]
65+ #[ arg( long, default_value_t = 3usize , value_name = tr!( "cli-value-num" ) , help = tr!( "cli-info-number-of-authors" ) ) ]
6466 pub number_of_authors : usize ,
65- /// Maximum NUM of languages to be shown
66- #[ arg( long, default_value_t = 6usize , value_name = "NUM" ) ]
67+ #[ arg( long, default_value_t = 6usize , value_name = tr!( "cli-value-num" ) , help = tr!( "cli-info-number-of-languages" ) ) ]
6768 pub number_of_languages : usize ,
68- /// Maximum NUM of file churns to be shown
69- #[ arg( long, default_value_t = 3usize , value_name = "NUM" ) ]
69+ #[ arg( long, default_value_t = 3usize , value_name = tr!( "cli-value-num" ) , help = tr!( "cli-info-number-of-file-churns" ) ) ]
7070 pub number_of_file_churns : usize ,
71- /// Minimum NUM of commits from HEAD used to compute the churn summary
72- ///
73- /// By default, the actual value is non-deterministic due to time-based computation
74- /// and will be displayed under the info title "Churn (NUM)"
75- #[ arg( long, value_name = "NUM" ) ]
71+ #[ arg( long, value_name = "NUM" , help = tr!( "cli-info-churn-pool-size" ) ) ]
7672 pub churn_pool_size : Option < usize > ,
77- /// Ignore all files & directories matching EXCLUDE
78- #[ arg( long, short, num_args = 1 ..) ]
73+ #[ arg( long, short, num_args = 1 .., help = tr!( "cli-info-exclude" ) , value_name = tr!( "cli-value-exclude" ) ) ]
7974 pub exclude : Vec < String > ,
80- /// Exclude [bot] commits. Use <REGEX> to override the default pattern
8175 #[ arg(
8276 long,
8377 num_args = 0 ..=1 ,
8478 require_equals = true ,
8579 default_missing_value = NO_BOTS_DEFAULT_REGEX_PATTERN ,
86- value_name = "REGEX"
80+ value_name = tr!( "cli-value-regex" ) ,
81+ help = tr!( "cli-info-no-bots" )
8782 ) ]
8883 pub no_bots : Option < MyRegex > ,
89- /// Ignores merge commits
90- #[ arg( long) ]
84+ #[ arg( long, help = tr!( "cli-info-no-merges" ) ) ]
9185 pub no_merges : bool ,
92- /// Show the email address of each author
93- #[ arg( long, short = 'E' ) ]
86+ #[ arg( long, short = 'E' , help = tr!( "cli-info-email" ) ) ]
9487 pub email : bool ,
95- /// Display repository URL as HTTP
96- #[ arg( long) ]
88+ #[ arg( long, help = tr!( "cli-info-http-url" ) ) ]
9789 pub http_url : bool ,
98- /// Hide token in repository URL
99- #[ arg( long) ]
90+ #[ arg( long, help = tr!( "cli-info-hide-token" ) ) ]
10091 pub hide_token : bool ,
101- /// Count hidden files and directories
102- #[ arg( long) ]
92+ #[ arg( long, help = tr!( "cli-info-include-hidden" ) ) ]
10393 pub include_hidden : bool ,
104- /// Filters output by language type
10594 #[ arg(
10695 long,
10796 num_args = 1 ..,
10897 default_values = & [ "programming" , "markup" ] ,
10998 short = 'T' ,
11099 value_enum,
100+ help = tr!( "cli-info-type" )
111101 ) ]
112102 pub r#type : Vec < LanguageType > ,
113103}
0 commit comments