mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
refactor/pr: polish spelling
This commit is contained in:
parent
8de42ed18e
commit
41878f1bf4
2 changed files with 26 additions and 22 deletions
|
@ -6,6 +6,8 @@
|
||||||
// that was distributed with this source code.
|
// that was distributed with this source code.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// spell-checker:ignore (ToDO) adFfmprt, kmerge
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate quick_error;
|
extern crate quick_error;
|
||||||
|
|
||||||
|
@ -204,7 +206,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
options::NUMBERING_MODE_OPTION,
|
options::NUMBERING_MODE_OPTION,
|
||||||
"number-lines",
|
"number-lines",
|
||||||
"Provide width digit line numbering. The default for width, if not specified, is 5. The number occupies
|
"Provide width digit line numbering. The default for width, if not specified, is 5. The number occupies
|
||||||
the first width column positions of each text column or each line of -m output. If char (any nondigit
|
the first width column positions of each text column or each line of -m output. If char (any non-digit
|
||||||
character) is given, it is appended to the line number to separate it from whatever follows. The default
|
character) is given, it is appended to the line number to separate it from whatever follows. The default
|
||||||
for char is a <tab>. Line numbers longer than width columns are truncated.",
|
for char is a <tab>. Line numbers longer than width columns are truncated.",
|
||||||
"[char][width]",
|
"[char][width]",
|
||||||
|
@ -274,8 +276,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
options::COLUMN_OPTION,
|
options::COLUMN_OPTION,
|
||||||
"Produce multi-column output that is arranged in column columns (the default shall be 1) and is written down each
|
"Produce multi-column output that is arranged in column columns (the default shall be 1) and is written down each
|
||||||
column in the order in which the text is received from the input file. This option should not be used with -m.
|
column in the order in which the text is received from the input file. This option should not be used with -m.
|
||||||
The options -e and -i shall be assumed for multiple text-column output. Whether or not text columns are pro‐
|
The options -e and -i shall be assumed for multiple text-column output. Whether or not text columns are produced
|
||||||
duced with identical vertical lengths is unspecified, but a text column shall never exceed the length of the
|
with identical vertical lengths is unspecified, but a text column shall never exceed the length of the
|
||||||
page (see the -l option). When used with -t, use the minimum number of lines to write the output.",
|
page (see the -l option). When used with -t, use the minimum number of lines to write the output.",
|
||||||
"[column]",
|
"[column]",
|
||||||
HasArg::Yes,
|
HasArg::Yes,
|
||||||
|
@ -286,8 +288,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
options::COLUMN_WIDTH_OPTION,
|
options::COLUMN_WIDTH_OPTION,
|
||||||
"width",
|
"width",
|
||||||
"Set the width of the line to width column positions for multiple text-column output only. If the -w option is
|
"Set the width of the line to width column positions for multiple text-column output only. If the -w option is
|
||||||
not specified and the -s option is not specified, the default width shall be 72. If the -w option is not speci‐
|
not specified and the -s option is not specified, the default width shall be 72. If the -w option is not specified
|
||||||
fied and the -s option is specified, the default width shall be 512.",
|
and the -s option is specified, the default width shall be 512.",
|
||||||
"[width]",
|
"[width]",
|
||||||
HasArg::Yes,
|
HasArg::Yes,
|
||||||
Occur::Optional,
|
Occur::Optional,
|
||||||
|
@ -472,9 +474,9 @@ fn print_usage(opts: &mut getopts::Options, matches: &Matches) -> i32 {
|
||||||
);
|
);
|
||||||
println!();
|
println!();
|
||||||
let usage: &str = "The pr utility is a printing and pagination filter
|
let usage: &str = "The pr utility is a printing and pagination filter
|
||||||
for text files. When multiple input files are spec-
|
for text files. When multiple input files are specified,
|
||||||
ified, each is read, formatted, and written to stan-
|
each is read, formatted, and written to standard
|
||||||
dard output. By default, the input is separated
|
output. By default, the input is separated
|
||||||
into 66-line pages, each with
|
into 66-line pages, each with
|
||||||
|
|
||||||
o A 5-line header with the page number, date,
|
o A 5-line header with the page number, date,
|
||||||
|
@ -486,8 +488,8 @@ fn print_usage(opts: &mut getopts::Options, matches: &Matches) -> i32 {
|
||||||
diagnostic messages are suppressed until the pr
|
diagnostic messages are suppressed until the pr
|
||||||
utility has completed processing.
|
utility has completed processing.
|
||||||
|
|
||||||
When multiple column output is specified, text col-
|
When multiple column output is specified, text columns
|
||||||
umns are of equal width. By default text columns
|
are of equal width. By default text columns
|
||||||
are separated by at least one <blank>. Input lines
|
are separated by at least one <blank>. Input lines
|
||||||
that do not fit into a text column are truncated.
|
that do not fit into a text column are truncated.
|
||||||
Lines are not truncated under single column output.";
|
Lines are not truncated under single column output.";
|
||||||
|
@ -599,8 +601,8 @@ fn build_options(
|
||||||
let line_separator = "\n".to_string();
|
let line_separator = "\n".to_string();
|
||||||
|
|
||||||
let last_modified_time = if is_merge_mode || paths[0].eq(FILE_STDIN) {
|
let last_modified_time = if is_merge_mode || paths[0].eq(FILE_STDIN) {
|
||||||
let datetime = Local::now();
|
let date_time = Local::now();
|
||||||
datetime.format("%b %d %H:%M %Y").to_string()
|
date_time.format("%b %d %H:%M %Y").to_string()
|
||||||
} else {
|
} else {
|
||||||
file_last_modified_time(paths.get(0).unwrap())
|
file_last_modified_time(paths.get(0).unwrap())
|
||||||
};
|
};
|
||||||
|
@ -951,7 +953,7 @@ fn read_stream_and_create_pages(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mpr(paths: &[String], options: &OutputOptions) -> Result<i32, PrError> {
|
fn mpr(paths: &[String], options: &OutputOptions) -> Result<i32, PrError> {
|
||||||
let nfiles = paths.len();
|
let n_files = paths.len();
|
||||||
|
|
||||||
// Check if files exists
|
// Check if files exists
|
||||||
for path in paths {
|
for path in paths {
|
||||||
|
@ -972,7 +974,7 @@ fn mpr(paths: &[String], options: &OutputOptions) -> Result<i32, PrError> {
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|fl| FileLine {
|
.map(|fl| FileLine {
|
||||||
page_number,
|
page_number,
|
||||||
group_key: page_number * nfiles + fl.file_id,
|
group_key: page_number * n_files + fl.file_id,
|
||||||
..fl
|
..fl
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
|
@ -1147,11 +1149,11 @@ fn get_line_for_printing(
|
||||||
indexes: usize,
|
indexes: usize,
|
||||||
) -> String {
|
) -> String {
|
||||||
let blank_line = String::new();
|
let blank_line = String::new();
|
||||||
let fmtd_line_number = get_fmtd_line_number(&options, file_line.line_number, index);
|
let formatted_line_number = get_formatted_line_number(&options, file_line.line_number, index);
|
||||||
|
|
||||||
let mut complete_line = format!(
|
let mut complete_line = format!(
|
||||||
"{}{}",
|
"{}{}",
|
||||||
fmtd_line_number,
|
formatted_line_number,
|
||||||
file_line.line_content.as_ref().unwrap()
|
file_line.line_content.as_ref().unwrap()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1186,7 +1188,7 @@ fn get_line_for_printing(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_fmtd_line_number(opts: &OutputOptions, line_number: usize, index: usize) -> String {
|
fn get_formatted_line_number(opts: &OutputOptions, line_number: usize, index: usize) -> String {
|
||||||
let should_show_line_number =
|
let should_show_line_number =
|
||||||
opts.number.is_some() && (opts.merge_files_print.is_none() || index == 0);
|
opts.number.is_some() && (opts.merge_files_print.is_none() || index == 0);
|
||||||
if should_show_line_number && line_number != 0 {
|
if should_show_line_number && line_number != 0 {
|
||||||
|
@ -1234,8 +1236,8 @@ fn file_last_modified_time(path: &str) -> String {
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
i.modified()
|
i.modified()
|
||||||
.map(|x| {
|
.map(|x| {
|
||||||
let datetime: DateTime<Local> = x.into();
|
let date_time: DateTime<Local> = x.into();
|
||||||
datetime.format("%b %d %H:%M %Y").to_string()
|
date_time.format("%b %d %H:%M %Y").to_string()
|
||||||
})
|
})
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// spell-checker:ignore (ToDO) Sdivide
|
||||||
|
|
||||||
use crate::common::util::*;
|
use crate::common::util::*;
|
||||||
use chrono::offset::Local;
|
use chrono::offset::Local;
|
||||||
use chrono::DateTime;
|
use chrono::DateTime;
|
||||||
|
@ -11,8 +13,8 @@ fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String {
|
||||||
return i
|
return i
|
||||||
.modified()
|
.modified()
|
||||||
.map(|x| {
|
.map(|x| {
|
||||||
let datetime: DateTime<Local> = x.into();
|
let date_time: DateTime<Local> = x.into();
|
||||||
datetime.format("%b %d %H:%M %Y").to_string()
|
date_time.format("%b %d %H:%M %Y").to_string()
|
||||||
})
|
})
|
||||||
.unwrap_or(String::new());
|
.unwrap_or(String::new());
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue