Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/uu/nl/src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
3 changes: 2 additions & 1 deletion src/uu/nl/src/nl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions tests/by-util/test_nl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}