7
7
#![ allow( clippy:: upper_case_acronyms) ]
8
8
9
9
use clap:: builder:: ValueParser ;
10
- use uucore:: LocalizedCommand ;
11
10
use uucore:: error:: { UResult , USimpleError , UUsageError } ;
12
11
use uucore:: translate;
13
12
use uucore:: { display:: Quotable , format_usage, show_error, show_warning} ;
@@ -155,20 +154,14 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
155
154
}
156
155
157
156
pub fn uu_app ( ) -> Command {
158
- Command :: new ( uucore:: util_name ( ) )
157
+ let cmd = Command :: new ( uucore:: util_name ( ) )
159
158
. version ( uucore:: crate_version!( ) )
160
- . help_template ( uucore:: localized_help_template ( uucore:: util_name ( ) ) )
161
159
. about ( translate ! ( "chcon-about" ) )
162
160
. override_usage ( format_usage ( & translate ! ( "chcon-usage" ) ) )
163
- . infer_long_args ( true )
164
- . disable_help_flag ( true )
161
+ . infer_long_args ( true ) ;
162
+ uucore :: clap_localization :: configure_localized_command ( cmd )
165
163
. args_override_self ( true )
166
- . arg (
167
- Arg :: new ( options:: HELP )
168
- . long ( options:: HELP )
169
- . help ( translate ! ( "chcon-help-help" ) )
170
- . action ( ArgAction :: Help ) ,
171
- )
164
+ . disable_help_flag ( true )
172
165
. arg (
173
166
Arg :: new ( options:: dereference:: DEREFERENCE )
174
167
. long ( options:: dereference:: DEREFERENCE )
@@ -183,6 +176,12 @@ pub fn uu_app() -> Command {
183
176
. help ( translate ! ( "chcon-help-no-dereference" ) )
184
177
. action ( ArgAction :: SetTrue ) ,
185
178
)
179
+ . arg (
180
+ Arg :: new ( "help" )
181
+ . long ( "help" )
182
+ . help ( translate ! ( "help" ) )
183
+ . action ( ArgAction :: Help ) ,
184
+ )
186
185
. arg (
187
186
Arg :: new ( options:: preserve_root:: PRESERVE_ROOT )
188
187
. long ( options:: preserve_root:: PRESERVE_ROOT )
@@ -305,7 +304,7 @@ struct Options {
305
304
}
306
305
307
306
fn parse_command_line ( config : Command , args : impl uucore:: Args ) -> Result < Options > {
308
- let matches = config. get_matches_from_localized ( args) ;
307
+ let matches = config. try_get_matches_from ( args) ? ;
309
308
310
309
let verbose = matches. get_flag ( options:: VERBOSE ) ;
311
310
0 commit comments