@@ -170,18 +170,7 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
170170 . map ( |s| s. as_os_str ( ) ) ;
171171
172172 if check {
173- // on Windows, allow --binary/--text to be used with --check
174- // and keep the behavior of defaulting to binary
175- #[ cfg( not( windows) ) ]
176- {
177- let text_flag = matches. get_flag ( "text" ) ;
178- let binary_flag = matches. get_flag ( "binary" ) ;
179-
180- if binary_flag || text_flag {
181- return Err ( ChecksumError :: BinaryTextConflict . into ( ) ) ;
182- }
183- }
184-
173+ // 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.
185174 let verbose = ChecksumVerbose :: new ( status, quiet, warn) ;
186175
187176 let opts = ChecksumValidateOptions {
@@ -231,6 +220,10 @@ mod options {
231220}
232221
233222pub 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...
234227 Command :: new ( uucore:: util_name ( ) )
235228 . version ( uucore:: crate_version!( ) )
236229 . help_template ( uucore:: localized_help_template ( uucore:: util_name ( ) ) )
@@ -260,7 +253,9 @@ pub fn uu_app_common() -> Command {
260253 . long ( "check" )
261254 . help ( translate ! ( "hashsum-help-check" ) )
262255 . action ( ArgAction :: SetTrue )
263- . conflicts_with ( "tag" ) ,
256+ . conflicts_with ( options:: BINARY )
257+ . conflicts_with ( options:: TEXT )
258+ . conflicts_with ( options:: TAG ) ,
264259 )
265260 . arg (
266261 Arg :: new ( options:: TAG )
@@ -293,6 +288,7 @@ pub fn uu_app_common() -> Command {
293288 . help ( translate ! ( "hashsum-help-quiet" ) )
294289 . action ( ArgAction :: SetTrue )
295290 . overrides_with_all ( [ options:: STATUS , options:: WARN ] )
291+ . conflicts_with ( "text" )
296292 . requires ( options:: CHECK ) ,
297293 )
298294 . arg (
@@ -302,20 +298,23 @@ pub fn uu_app_common() -> Command {
302298 . help ( translate ! ( "hashsum-help-status" ) )
303299 . action ( ArgAction :: SetTrue )
304300 . overrides_with_all ( [ options:: QUIET , options:: WARN ] )
301+ . conflicts_with ( "text" )
305302 . requires ( options:: CHECK ) ,
306303 )
307304 . arg (
308305 Arg :: new ( options:: STRICT )
309306 . long ( "strict" )
310307 . help ( translate ! ( "hashsum-help-strict" ) )
311308 . action ( ArgAction :: SetTrue )
309+ . conflicts_with ( "text" )
312310 . requires ( options:: CHECK ) ,
313311 )
314312 . arg (
315313 Arg :: new ( "ignore-missing" )
316314 . long ( "ignore-missing" )
317315 . help ( translate ! ( "hashsum-help-ignore-missing" ) )
318316 . action ( ArgAction :: SetTrue )
317+ . conflicts_with ( "text" )
319318 . requires ( options:: CHECK ) ,
320319 )
321320 . arg (
@@ -325,6 +324,7 @@ pub fn uu_app_common() -> Command {
325324 . help ( translate ! ( "hashsum-help-warn" ) )
326325 . action ( ArgAction :: SetTrue )
327326 . overrides_with_all ( [ options:: QUIET , options:: STATUS ] )
327+ . conflicts_with ( "text" )
328328 . requires ( options:: CHECK ) ,
329329 )
330330 . arg (
0 commit comments