@@ -47,13 +47,15 @@ pub mod options {
4747const MULTI_FILE_TOP_PROMPT : & str = "\r ::::::::::::::\n \r {}\n \r ::::::::::::::\n " ;
4848
4949struct Options {
50+ silent : bool ,
51+ _logical : bool , // not implemented
52+ _no_pause : bool , // not implemented
53+ print_over : bool ,
5054 clean_print : bool ,
51- from_line : usize ,
55+ squeeze : bool ,
5256 lines : Option < u16 > ,
57+ from_line : usize ,
5358 pattern : Option < String > ,
54- print_over : bool ,
55- silent : bool ,
56- squeeze : bool ,
5759}
5860
5961impl Options {
@@ -76,13 +78,15 @@ impl Options {
7678 . get_one :: < String > ( options:: PATTERN )
7779 . map ( |s| s. to_owned ( ) ) ;
7880 Self {
81+ silent : matches. get_flag ( options:: SILENT ) ,
82+ _logical : matches. get_flag ( options:: LOGICAL ) ,
83+ _no_pause : matches. get_flag ( options:: NO_PAUSE ) ,
84+ print_over : matches. get_flag ( options:: PRINT_OVER ) ,
7985 clean_print : matches. get_flag ( options:: CLEAN_PRINT ) ,
80- from_line ,
86+ squeeze : matches . get_flag ( options :: SQUEEZE ) ,
8187 lines,
88+ from_line,
8289 pattern,
83- print_over : matches. get_flag ( options:: PRINT_OVER ) ,
84- silent : matches. get_flag ( options:: SILENT ) ,
85- squeeze : matches. get_flag ( options:: SQUEEZE ) ,
8690 }
8791 }
8892}
@@ -242,58 +246,55 @@ pub fn uu_app() -> Command {
242246 . override_usage ( format_usage ( USAGE ) )
243247 . version ( uucore:: crate_version!( ) )
244248 . infer_long_args ( true )
245- . arg (
246- Arg :: new ( options:: PRINT_OVER )
247- . short ( 'c' )
248- . long ( options:: PRINT_OVER )
249- . help ( "Do not scroll, display text and clean line ends" )
250- . action ( ArgAction :: SetTrue ) ,
251- )
252249 . arg (
253250 Arg :: new ( options:: SILENT )
254251 . short ( 'd' )
255252 . long ( options:: SILENT )
256- . help ( "Display help instead of ringing bell" )
257- . action ( ArgAction :: SetTrue ) ,
253+ . action ( ArgAction :: SetTrue )
254+ . help ( "Display help instead of ringing bell when an illegal key is pressed." ) ,
258255 )
259256 . arg (
260- Arg :: new ( options:: CLEAN_PRINT )
257+ Arg :: new ( options:: LOGICAL )
258+ . short ( 'f' )
259+ . long ( options:: LOGICAL )
260+ . action ( ArgAction :: SetTrue )
261+ . help ( "Do not pause after form feed" ) ,
262+ )
263+ . arg (
264+ Arg :: new ( options:: NO_PAUSE )
265+ . short ( 'l' )
266+ . long ( options:: NO_PAUSE )
267+ . action ( ArgAction :: SetTrue )
268+ . help ( "Count logical lines rather than screen lines" ) ,
269+ )
270+ . arg (
271+ Arg :: new ( options:: PRINT_OVER )
261272 . short ( 'p' )
273+ . long ( options:: PRINT_OVER )
274+ . action ( ArgAction :: SetTrue )
275+ . help ( "Do not scroll, clean screen and display text" ) ,
276+ )
277+ . arg (
278+ Arg :: new ( options:: CLEAN_PRINT )
279+ . short ( 'c' )
262280 . long ( options:: CLEAN_PRINT )
263- . help ( "Do not scroll, clean screen and display text" )
264- . action ( ArgAction :: SetTrue ) ,
281+ . action ( ArgAction :: SetTrue )
282+ . help ( "Do not scroll, display text and clean line ends" ) ,
265283 )
266284 . arg (
267285 Arg :: new ( options:: SQUEEZE )
268286 . short ( 's' )
269287 . long ( options:: SQUEEZE )
270- . help ( "Squeeze multiple blank lines into one" )
271- . action ( ArgAction :: SetTrue ) ,
288+ . action ( ArgAction :: SetTrue )
289+ . help ( "Squeeze multiple blank lines into one" ) ,
272290 )
273291 . arg (
274292 Arg :: new ( options:: PLAIN )
275293 . short ( 'u' )
276294 . long ( options:: PLAIN )
277295 . action ( ArgAction :: SetTrue )
278- . hide ( true ) ,
279- )
280- . arg (
281- Arg :: new ( options:: PATTERN )
282- . short ( 'P' )
283- . long ( options:: PATTERN )
284- . allow_hyphen_values ( true )
285- . required ( false )
286- . value_name ( "pattern" )
287- . help ( "Display file beginning from pattern match" ) ,
288- )
289- . arg (
290- Arg :: new ( options:: FROM_LINE )
291- . short ( 'F' )
292- . long ( options:: FROM_LINE )
293- . num_args ( 1 )
294- . value_name ( "number" )
295- . value_parser ( value_parser ! ( usize ) )
296- . help ( "Display file beginning from line number" ) ,
296+ . hide ( true )
297+ . help ( "Suppress underlining" ) ,
297298 )
298299 . arg (
299300 Arg :: new ( options:: LINES )
@@ -309,23 +310,26 @@ pub fn uu_app() -> Command {
309310 . long ( options:: NUMBER )
310311 . num_args ( 1 )
311312 . value_parser ( value_parser ! ( u16 ) . range ( 0 ..) )
312- . help ( "Same as --lines" ) ,
313+ . help ( "same as --lines option argument " ) ,
313314 )
314- // The commented arguments below are unimplemented:
315- /*
316315 . arg (
317- Arg::new(options::LOGICAL)
318- .short('f')
319- .long(options::LOGICAL)
320- .help("Count logical rather than screen lines"),
316+ Arg :: new ( options:: FROM_LINE )
317+ . short ( 'F' )
318+ . long ( options:: FROM_LINE )
319+ . num_args ( 1 )
320+ . value_name ( "number" )
321+ . value_parser ( value_parser ! ( usize ) )
322+ . help ( "Start displaying each file at line number" ) ,
321323 )
322324 . arg (
323- Arg::new(options::NO_PAUSE)
324- .short('l')
325- .long(options::NO_PAUSE)
326- .help("Suppress pause after form feed"),
325+ Arg :: new ( options:: PATTERN )
326+ . short ( 'P' )
327+ . long ( options:: PATTERN )
328+ . allow_hyphen_values ( true )
329+ . required ( false )
330+ . value_name ( "pattern" )
331+ . help ( "The string to be searched in each file before starting to display it" ) ,
327332 )
328- */
329333 . arg (
330334 Arg :: new ( options:: FILES )
331335 . required ( false )
@@ -784,13 +788,15 @@ mod tests {
784788 Self {
785789 content : content. to_string ( ) ,
786790 options : Options {
791+ silent : false ,
792+ _logical : false ,
793+ _no_pause : false ,
794+ print_over : false ,
787795 clean_print : false ,
788- from_line : 0 ,
796+ squeeze : false ,
789797 lines : None ,
798+ from_line : 0 ,
790799 pattern : None ,
791- print_over : false ,
792- silent : false ,
793- squeeze : false ,
794800 } ,
795801 rows : 24 ,
796802 next_file : None ,
0 commit comments