File tree Expand file tree Collapse file tree 3 files changed +25
-29
lines changed
Expand file tree Collapse file tree 3 files changed +25
-29
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ use coreutils::validation;
88use itertools:: Itertools as _;
99use std:: cmp;
1010use std:: ffi:: OsString ;
11- use std:: io:: { self , Write } ;
1211use std:: process;
1312use uucore:: Args ;
1413
@@ -106,33 +105,10 @@ fn main() {
106105 process:: exit ( uumain ( vec ! [ util_os] . into_iter ( ) . chain ( args) ) ) ;
107106 }
108107 None => {
108+ // GNU coreutils --help string shows help for coreutils
109109 if util == "--help" || util == "-h" {
110- // see if they want help on a specific util
111- if let Some ( util_os) = args. next ( ) {
112- let Some ( util) = util_os. to_str ( ) else {
113- validation:: not_found ( & util_os)
114- } ;
115-
116- match utils. get ( util) {
117- Some ( & ( uumain, _) ) => {
118- let code = uumain (
119- vec ! [ util_os, OsString :: from( "--help" ) ]
120- . into_iter ( )
121- . chain ( args) ,
122- ) ;
123- io:: stdout ( ) . flush ( ) . expect ( "could not flush stdout" ) ;
124- process:: exit ( code) ;
125- }
126- None => validation:: not_found ( & util_os) ,
127- }
128- }
129110 usage ( & utils, binary_as_util) ;
130111 process:: exit ( 0 ) ;
131- } else if util. starts_with ( '-' ) {
132- // Argument looks like an option but wasn't recognized
133- validation:: unrecognized_option ( binary_as_util, & util_os) ;
134- } else {
135- validation:: not_found ( & util_os) ;
136112 }
137113 }
138114 }
Original file line number Diff line number Diff line change @@ -26,6 +26,24 @@ fn init() {
2626 eprintln ! ( "Setting UUTESTS_BINARY_PATH={TESTS_BINARY}" ) ;
2727}
2828
29+ #[ test]
30+ fn test_coreutils_help_ignore_args ( ) {
31+ use std:: process:: Command ;
32+
33+ let scenario = TestScenario :: new ( "help_ignoring_args" ) ;
34+ if !scenario. bin_path . exists ( ) {
35+ return ;
36+ }
37+
38+ let output = Command :: new ( & scenario. bin_path )
39+ . arg ( "--help" )
40+ . arg ( "---" )
41+ . output ( )
42+ . unwrap ( ) ;
43+
44+ assert_eq ! ( output. status. code( ) , Some ( 0 ) ) ;
45+ }
46+
2947#[ test]
3048#[ cfg( feature = "ls" ) ]
3149fn execution_phrase_double ( ) {
Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ repo=https://github.com/coreutils/coreutils
44curl -L " ${repo} /releases/download/v${ver} /coreutils-${ver} .tar.xz" | tar --strip-components=1 -xJf -
55
66# TODO stop backporting tests from master at GNU coreutils > $ver
7- # backport = ()
8- # for f in ${backport[@]}
9- # do curl -L ${repo}/raw/refs/heads/master/tests/$f > tests/$f
10- # done
7+ backport=(
8+ misc/coreutils.sh
9+ )
10+ for f in " ${backport[@]} "
11+ do curl -L ${repo} /raw/refs/heads/master/tests/$f > tests/$f
12+ done
You can’t perform that action at this time.
0 commit comments