@@ -171,18 +171,7 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
171171 ) ;
172172
173173 if check {
174- // on Windows, allow --binary/--text to be used with --check
175- // and keep the behavior of defaulting to binary
176- #[ cfg( not( windows) ) ]
177- {
178- let text_flag = matches. get_flag ( "text" ) ;
179- let binary_flag = matches. get_flag ( "binary" ) ;
180-
181- if binary_flag || text_flag {
182- return Err ( ChecksumError :: BinaryTextConflict . into ( ) ) ;
183- }
184- }
185-
174+ // 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.
186175 let verbose = ChecksumVerbose :: new ( status, quiet, warn) ;
187176
188177 let opts = ChecksumValidateOptions {
@@ -232,6 +221,10 @@ mod options {
232221}
233222
234223pub fn uu_app_common ( ) -> Command {
224+ // --text --arg-deps-check should be error by Arg::new(options::CHECK)...conflicts_with(options::TEXT)
225+ // https://github.com/clap-rs/clap/issues/4520 ?
226+ // Let --{warn,strict,quiet,status,ignore-missing} reject --text and remove them later.
227+ // Bad error message, but not a lie...
235228 Command :: new ( uucore:: util_name ( ) )
236229 . version ( uucore:: crate_version!( ) )
237230 . help_template ( uucore:: localized_help_template ( uucore:: util_name ( ) ) )
@@ -261,7 +254,9 @@ pub fn uu_app_common() -> Command {
261254 . long ( "check" )
262255 . help ( translate ! ( "hashsum-help-check" ) )
263256 . action ( ArgAction :: SetTrue )
264- . conflicts_with ( "tag" ) ,
257+ . conflicts_with ( options:: BINARY )
258+ . conflicts_with ( options:: TEXT )
259+ . conflicts_with ( options:: TAG ) ,
265260 )
266261 . arg (
267262 Arg :: new ( options:: TAG )
@@ -294,6 +289,7 @@ pub fn uu_app_common() -> Command {
294289 . help ( translate ! ( "hashsum-help-quiet" ) )
295290 . action ( ArgAction :: SetTrue )
296291 . overrides_with_all ( [ options:: STATUS , options:: WARN ] )
292+ . conflicts_with ( "text" )
297293 . requires ( options:: CHECK ) ,
298294 )
299295 . arg (
@@ -303,20 +299,23 @@ pub fn uu_app_common() -> Command {
303299 . help ( translate ! ( "hashsum-help-status" ) )
304300 . action ( ArgAction :: SetTrue )
305301 . overrides_with_all ( [ options:: QUIET , options:: WARN ] )
302+ . conflicts_with ( "text" )
306303 . requires ( options:: CHECK ) ,
307304 )
308305 . arg (
309306 Arg :: new ( options:: STRICT )
310307 . long ( "strict" )
311308 . help ( translate ! ( "hashsum-help-strict" ) )
312309 . action ( ArgAction :: SetTrue )
310+ . conflicts_with ( "text" )
313311 . requires ( options:: CHECK ) ,
314312 )
315313 . arg (
316314 Arg :: new ( "ignore-missing" )
317315 . long ( "ignore-missing" )
318316 . help ( translate ! ( "hashsum-help-ignore-missing" ) )
319317 . action ( ArgAction :: SetTrue )
318+ . conflicts_with ( "text" )
320319 . requires ( options:: CHECK ) ,
321320 )
322321 . arg (
@@ -326,6 +325,7 @@ pub fn uu_app_common() -> Command {
326325 . help ( translate ! ( "hashsum-help-warn" ) )
327326 . action ( ArgAction :: SetTrue )
328327 . overrides_with_all ( [ options:: QUIET , options:: STATUS ] )
328+ . conflicts_with ( "text" )
329329 . requires ( options:: CHECK ) ,
330330 )
331331 . arg (
0 commit comments