From c8aa65bf26cf7ccc68563429a8c5218f7b172266 Mon Sep 17 00:00:00 2001 From: Alex Hallam Date: Wed, 11 May 2022 23:49:38 -0400 Subject: [PATCH] Bug/e (#128) * fix bug in -e * dont bump the version * push new version * update change log --- CHANGELOG.md | 8 ++++++++ Cargo.lock | 2 +- Cargo.toml | 6 +++--- src/main.rs | 7 ++++++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e41381e..edecbcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +1.4.5 (2021-5-1) +================== + +* **Bug 1** Though `-e` was added as an option I found that it was not overriding the `-n` argument. The fix was made with a simple if/else statement. + +It may seem odd to bump the version with such a small bug, but I did not want to have something in the help file that was not functional in +the CLI. + 1.4.4 (2021-5-02) ================== diff --git a/Cargo.lock b/Cargo.lock index d11a289..e2ee7ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -563,7 +563,7 @@ dependencies = [ [[package]] name = "tidy-viewer" -version = "1.4.4" +version = "1.4.5" dependencies = [ "atty", "calm_io", diff --git a/Cargo.toml b/Cargo.toml index 44a77f8..05795da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,14 @@ [package] authors = ["alexhallam "] categories = ["command-line-utilities"] -description = "Head, but for csvs and with color" +description = "Head, but for CSV files and with color" edition = "2021" -keywords = ["csv", "pretty-print", "data-viewer", "tv", "tabular-data-viewer"] +keywords = ["csv", "pretty-print", "data-viewer", "tv", "tabular-data-viewer", "csv-viewer", "csv-pretty-print", "csv-cat", "csv-column"] license = "Unlicense/MIT" name = "tidy-viewer" readme = "README.md" repository = "https://github.com/alexhallam/tv" -version = "1.4.4" +version = "1.4.5" [package.metadata.deb] assets = [ diff --git a/src/main.rs b/src/main.rs index 6128251..33b668c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -360,8 +360,13 @@ fn main() { } let cols: usize = rdr[0].len(); - let rows: usize = rdr.len().min(row_display_option + 1); let rows_in_file: usize = rdr.len(); + let rows: usize = if extend_option { + rdr.len().min(rows_in_file + 1) + } else { + rdr.len().min(row_display_option + 1) + }; + let rows_remaining: usize = rows_in_file - rows; let ellipsis = '\u{2026}'.to_string(); let row_remaining_text: String = format!("{} with {} more rows", ellipsis, rows_remaining);