File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -276,14 +276,18 @@ pub fn uu_app() -> Command {
276276 . short ( 's' )
277277 . long ( options:: COLUMN_CHAR_SEPARATOR )
278278 . help ( translate ! ( "pr-help-column-char-separator" ) )
279- . value_name ( "char" ) ,
279+ . value_name ( "char" )
280+ . num_args ( 0 ..=1 )
281+ . default_missing_value ( "\t " ) ,
280282 )
281283 . arg (
282284 Arg :: new ( options:: COLUMN_STRING_SEPARATOR )
283285 . short ( 'S' )
284286 . long ( options:: COLUMN_STRING_SEPARATOR )
285287 . help ( translate ! ( "pr-help-column-string-separator" ) )
286- . value_name ( "string" ) ,
288+ . value_name ( "string" )
289+ . num_args ( 0 ..=1 )
290+ . default_missing_value ( " " ) ,
287291 )
288292 . arg (
289293 Arg :: new ( options:: MERGE )
Original file line number Diff line number Diff line change @@ -627,3 +627,17 @@ fn test_page_header_width() {
627627 let regex = Regex :: new ( & pattern) . unwrap ( ) ;
628628 new_ucmd ! ( ) . pipe_in ( "a" ) . succeeds ( ) . stdout_matches ( & regex) ;
629629}
630+
631+ #[ test]
632+ fn test_separator_options_default_values ( ) {
633+ // -s and -S without arguments should use default values (TAB and space)
634+ // TODO: verify output matches GNU pr behavior
635+ new_ucmd ! ( )
636+ . args ( & [ "-t" , "-2" , "-s" ] )
637+ . pipe_in ( "a\n b\n " )
638+ . succeeds ( ) ;
639+ new_ucmd ! ( )
640+ . args ( & [ "-t" , "-2" , "-S" ] )
641+ . pipe_in ( "a\n b\n " )
642+ . succeeds ( ) ;
643+ }
You can’t perform that action at this time.
0 commit comments