From e9453d0e209a1e1c62a88d5fecf0bceb995410e0 Mon Sep 17 00:00:00 2001 From: Alex Hallam Date: Sat, 6 Aug 2022 14:18:53 -0400 Subject: [PATCH] Col foot (#147) * add footer for short rows but wide columns * remove unneded db file * update change log * add some readme info * clean version * add changelog info * add some more changelog --- CHANGELOG.md | 26 +++++++++++++++++++++++--- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 8 +++++++- src/main.rs | 2 +- 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d8321e..2ee5df0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,24 @@ -1.4.6 (2022-7-23) +1.4.30 (2022-08-23) +================== + +`tv` is 1 year old 🎉🥳🎉. + +* **Bug** I noticed that `tv` would not print remaining columns if the number of rows was less than `n`. + +Changed `if rows_remaining > 0` to `if rows_remaining > 0 || (cols - num_cols_to_print) > 0` as the +condition needed to get the footer to kick in. + +Also, I was looking through the changelog and saw that I never gave credit to @burntsushi for holding +my hand as I was starting this project 1 year ago. I had a vision for this CLI, but was struggling with +some basics as I was learning Rust. Thank You! + +Note: Yes, I know there are a lot of versions skipped! I was struggling with getting some automated builds for +one of the releases. One quark is that builds are triggered with git tags. I used up a lot of git tags to test +things out. Which reminds me, thanks @certifiedloud for making the most recent builds possible. I could not +have done it without you. + + +1.4.6 (2022-07-23) ================== This update was mainly focused on feature enhancements. I also did some `clippy` formatting. @@ -21,7 +41,7 @@ As requested I implemented `-R`, `--no-row-numbering` for this functionality As requested I implemented `-D`, `--no-dimensions` for this functionality -1.4.5 (2021-5-1) +1.4.5 (2021-05-10) ================== * **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. @@ -29,7 +49,7 @@ As requested I implemented `-D`, `--no-dimensions` for this functionality 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) +1.4.4 (2021-05-02) ================== * **Feature 1** Added `-e` flag to extend rows (don't truncate). diff --git a/Cargo.lock b/Cargo.lock index 14e1fdf..b81e76c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -563,7 +563,7 @@ dependencies = [ [[package]] name = "tidy-viewer" -version = "1.4.6" +version = "1.4.30" dependencies = [ "atty", "calm_io", diff --git a/Cargo.toml b/Cargo.toml index bd3094e..40b74ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "Unlicense/MIT" name = "tidy-viewer" readme = "README.md" repository = "https://github.com/alexhallam/tv" -version = "1.4.6" +version = "1.4.30" [package.metadata.deb] assets = [ diff --git a/README.md b/README.md index 91a0798..77ed676 100644 --- a/README.md +++ b/README.md @@ -325,7 +325,7 @@ For information on dotfile configuration see `tv --help`. This allows users to s `tv --help` ```txt -tv 1.4.6 +tv 1.4.30 Tidy Viewer (tv) is a csv pretty printer that uses column styling to maximize viewer enjoyment.✨✨📺✨✨ Example Usage: @@ -426,6 +426,12 @@ ls -l --block-size=M # the data is farily large at 192MB sqlite3 :memory: -csv -header -cmd '.import taxi.csv taxi' 'SELECT passenger_count, COUNT(*), AVG(total_amount) FROM taxi GROUP BY passenger_count' | tv ``` +The above one-liner queries a csv as an in-memory database. It is also possible to query an *existing* `sqlite` database and pipe the output as a csv for `tv` to pick up. A one-liner is shown below. + +```bash +sqlite3 -csv -header 'select * from ;' | tv +``` + ## Use With DuckDB [DuckDB](https://duckdb.org/why_duckdb) has a lot in common with SQLite. As personal anecdotes I do like that fewer CLI flags are needed to run on csvs. I also like the speed. Though it is not as universal as SQLite I think that it is a good fit for command line data manipulation. diff --git a/src/main.rs b/src/main.rs index d16f1e6..90ec8b3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -693,7 +693,7 @@ fn main() { }); // additional row info - if rows_remaining > 0 { + if rows_remaining > 0 || (cols - num_cols_to_print) > 0 { let _ = match stdout!("{: >6} ", "") { Ok(_) => Ok(()), Err(e) => match e.kind() {