@@ -169,6 +169,13 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
169169 . unwrap ( )
170170 . map ( |s| s. as_os_str ( ) ) ;
171171
172+ // This should be done by clap. But https://github.com/clap-rs/clap/issues/4520
173+ if !check & ( warn || strict || quiet || ignore_missing || status) {
174+ return Err ( uucore:: error:: UUsageError :: new (
175+ 1 ,
176+ "the following required arguments were not provided:\n --check" . to_string ( ) ,
177+ ) ) ;
178+ }
172179 if check {
173180 // No reason to allow --check with --binary/--text on Cygwin. It want to be same with Linux and --text was broken for a long time.
174181 let verbose = ChecksumVerbose :: new ( status, quiet, warn) ;
@@ -220,10 +227,8 @@ mod options {
220227}
221228
222229pub fn uu_app_common ( ) -> Command {
223- // --text --arg-deps-check should be error by Arg::new(options::CHECK)...conflicts_with(options::TEXT)
224- // https://github.com/clap-rs/clap/issues/4520 ?
225- // Let --{warn,strict,quiet,status,ignore-missing} reject --text and remove them later.
226- // Bad error message, but not a lie...
230+ // --warn .requires(options::CHECK) allows bypassing --text --warn. We don't use it until clap 5
231+ // https://github.com/clap-rs/clap/issues/4520
227232 Command :: new ( uucore:: util_name ( ) )
228233 . version ( uucore:: crate_version!( ) )
229234 . help_template ( uucore:: localized_help_template ( uucore:: util_name ( ) ) )
@@ -288,7 +293,6 @@ pub fn uu_app_common() -> Command {
288293 . help ( translate ! ( "hashsum-help-quiet" ) )
289294 . action ( ArgAction :: SetTrue )
290295 . overrides_with_all ( [ options:: STATUS , options:: WARN ] )
291- . conflicts_with ( "text" )
292296 . requires ( options:: CHECK ) ,
293297 )
294298 . arg (
@@ -298,23 +302,20 @@ pub fn uu_app_common() -> Command {
298302 . help ( translate ! ( "hashsum-help-status" ) )
299303 . action ( ArgAction :: SetTrue )
300304 . overrides_with_all ( [ options:: QUIET , options:: WARN ] )
301- . conflicts_with ( "text" )
302305 . requires ( options:: CHECK ) ,
303306 )
304307 . arg (
305308 Arg :: new ( options:: STRICT )
306309 . long ( "strict" )
307310 . help ( translate ! ( "hashsum-help-strict" ) )
308311 . action ( ArgAction :: SetTrue )
309- . conflicts_with ( "text" )
310312 . requires ( options:: CHECK ) ,
311313 )
312314 . arg (
313315 Arg :: new ( "ignore-missing" )
314316 . long ( "ignore-missing" )
315317 . help ( translate ! ( "hashsum-help-ignore-missing" ) )
316318 . action ( ArgAction :: SetTrue )
317- . conflicts_with ( "text" )
318319 . requires ( options:: CHECK ) ,
319320 )
320321 . arg (
@@ -324,7 +325,6 @@ pub fn uu_app_common() -> Command {
324325 . help ( translate ! ( "hashsum-help-warn" ) )
325326 . action ( ArgAction :: SetTrue )
326327 . overrides_with_all ( [ options:: QUIET , options:: STATUS ] )
327- . conflicts_with ( "text" )
328328 . requires ( options:: CHECK ) ,
329329 )
330330 . arg (
0 commit comments