mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
Merge pull request #5036 from cakebaker/nl_fix_no_renumber
nl: make -p/--no-renumber a flag
This commit is contained in:
commit
c455aa0922
3 changed files with 10 additions and 2 deletions
|
@ -29,7 +29,7 @@ fn parse_style(chars: &[char]) -> Result<crate::NumberingStyle, String> {
|
|||
pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> Vec<String> {
|
||||
// This vector holds error messages encountered.
|
||||
let mut errs: Vec<String> = vec![];
|
||||
settings.renumber = !opts.contains_id(options::NO_RENUMBER);
|
||||
settings.renumber = opts.get_flag(options::NO_RENUMBER);
|
||||
match opts.get_one::<String>(options::NUMBER_SEPARATOR) {
|
||||
None => {}
|
||||
Some(val) => {
|
||||
|
|
|
@ -213,7 +213,8 @@ pub fn uu_app() -> Command {
|
|||
Arg::new(options::NO_RENUMBER)
|
||||
.short('p')
|
||||
.long(options::NO_RENUMBER)
|
||||
.help("do not reset line numbers at logical pages"),
|
||||
.help("do not reset line numbers at logical pages")
|
||||
.action(ArgAction::SetFalse),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::NUMBER_SEPARATOR)
|
||||
|
|
|
@ -71,3 +71,10 @@ fn test_sections_and_styles() {
|
|||
}
|
||||
// spell-checker:enable
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_no_renumber() {
|
||||
for arg in ["-p", "--no-renumber"] {
|
||||
new_ucmd!().arg(arg).succeeds();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue