Conversation
pr: Add -h to print custom header instead of file name pr: Add -n to print line numbers
pr: code refactoring for references
…umbers pr: Add -l option set number of lines pr: Refactor opts
pr: Add -F to print line feed character for page separator
pr: Fix number of lines printed per page pr: Fix first short page getting skipped due to page range
pr: Remove parameter header from build_options pr: Remove unnecessary get_input_type
pr: Add test for -h option pr: Add test for -d option
pr: Fix long name for -n pr: Add -N first line number option pr: Add -n[char][width] support
pr: Fix page ranges
pr: Add test for -l option pr: Add test for -r suppress error option
pr: Print fixed padded string for each column pr: Fix display length vs str length due to tabs
pr: Remove unwanted brancing in fill_missing_lines pr: Remove unnecessary error check pr: Rename key to group_key in FileLine pr: Reformat test_pr with rustfmt
pr: fix form feed pr: Rustfmt pr: add test for ff and -l option
pr: add -J option pr: add -S option
pr: refactor batching of pages in pr
pr: refactor common iterator between pr and mpr pr: remove fill lines in mpr
pr: extract recreate_arguments pr: refactor get_line_for_printing pr: refactor get_lines_for_printing pr: refactor fetch_indexes generate for write_columns pr: refactor write_columns pr: refactor write_columns
Only the minimum needed to: * Make everything compile without warnings * Move files according to the new project structure * Make tests pass
sylvestre
left a comment
There was a problem hiding this comment.
it will take some time to review it but here is a few comments
|
|
||
| type IOError = std::io::Error; | ||
|
|
||
| static NAME: &str = "pr"; |
There was a problem hiding this comment.
Could you please follow this example to declarations the options?
https://github.com/uutils/coreutils/blob/master/src/uu/ls/src/ls.rs#L78-L80
|
|
||
| pub fn uumain(args: impl uucore::Args) -> i32 { | ||
| let args = args.collect_str(); | ||
| let mut opts = getopts::Options::new(); |
There was a problem hiding this comment.
Not blocker but it would be nice to use clap instead of getopts
| fn recreate_arguments(args: &Vec<String>) -> Vec<String> { | ||
| let column_page_option = Regex::new(r"^[-+]\d+.*").unwrap(); | ||
| let num_regex: Regex = Regex::new(r"(.\d+)|(\d+)|^[^-]$").unwrap(); | ||
| //let a_file: Regex = Regex::new(r"^[^-+].*").unwrap(); |
There was a problem hiding this comment.
please remove useless comments
| } | ||
| } | ||
|
|
||
| fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { |
There was a problem hiding this comment.
this can be removed when/if moved to clap
| let option = value_to_parse.1; | ||
| i.parse::<usize>().map_err(|_e| { | ||
| PrError::EncounteredErrors(format!("invalid {} argument '{}'", option, i)) | ||
| }) |
There was a problem hiding this comment.
please add a test to cover this
| } | ||
| }); | ||
|
|
||
| let default_first_number: usize = NumberingMode::default().first_number; |
| @@ -0,0 +1,513 @@ | |||
| use crate::common::util::*; | |||
| @@ -0,0 +1,1343 @@ | |||
| #![crate_name = "uu_pr"] | |||
There was a problem hiding this comment.
the file is quite long, maybe it would make sense to split it?
|
@MaxSem ping? |
|
Sorry, was busy doing something else. Will try to find time in the next few days. |
|
@MaxSem ping? :) |
|
@MaxSem ping? :) |
|
@MaxSem ping? |
|
moved to |
This PR is a resurrection of #1327 by @tilakpatidar.
Closes #1874