Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option "--number of rows to output" requires spaces between words instead of dashes. #163

Closed
derekmahar opened this issue Jun 19, 2023 · 13 comments

Comments

@derekmahar
Copy link

derekmahar commented Jun 19, 2023

Option "--number of rows to output" requires spaces between words instead of dashes. All other long form options use a dash to delimit words. This is the first long form option that I've ever encountered that uses a space to delimit words.

$ tv "--number of rows to output" 5 currency_exchange_rates.csv

        tv dim: 248 x 4
        date                 source_currency_code target_currency_code rate
     1  2022-01-04T20:00:00Z USD                  CAD                  1.27
     2  2022-01-05T20:00:00Z USD                  CAD                  1.27
     3  2022-01-06T20:00:00Z USD                  CAD                  1.27
     4  2022-01-07T20:00:00Z USD                  CAD                  1.27
     5  2022-01-10T20:00:00Z USD                  CAD                  1.27
        … with 243 more rows
@derekmahar derekmahar changed the title Option "--number of rows to output" requires spaces between words instead of dashes. Option "--number of rows to output" requires spaces between words instead of dashes. All other long form options use a dash to delimit words. First long form option I've ever encountered that uses a space delimiter between words. Jun 19, 2023
@derekmahar derekmahar changed the title Option "--number of rows to output" requires spaces between words instead of dashes. All other long form options use a dash to delimit words. First long form option I've ever encountered that uses a space delimiter between words. Option "--number of rows to output" requires spaces between words instead of dashes. Jun 19, 2023
@alexhallam
Copy link
Owner

What the ... Who wrote this package? lol

I will make a fix. Thanks for letting me know.

@derekmahar
Copy link
Author

derekmahar commented Jun 19, 2023

I'm surprised that no one else noticed before now. Might not have been a very popular option, users never bothered to enter the long option, or simply never bothered to report it.

@derekmahar
Copy link
Author

derekmahar commented Jun 19, 2023

Found the culprit:

    #[structopt(
        short = "n",
        long = "number of rows to output",
        default_value = "25",
        help = "Show how many rows to display."
    )]

Looks like you may have confused parameter long with help.

@alexhallam
Copy link
Owner

#164

This is a fix. It is always good to have a second set of eyes even for small changes. Let me know what you think. Also, I am not sure I will make a new version number for this. So you would have to download and compile from source. How does that sound?

@derekmahar
Copy link
Author

The fix looks correct.

I've installed tidy-viewer from source on one of my hosts, but on four others, I used Nix to install version 1.4.30 of the tidy-viewer binary. I could install tidy-viewer from source on these other hosts, too, since they also have Cargo and the Rust compiler installed, but I might just wait until you release the next version of tidy-viewer. Nix tends to update its packages soon after developers release new versions.

@alexhallam
Copy link
Owner

Wow, I love how strong of a user you are! Five hosts in total!

Just because of that, I will make a release. Give me a couple of days.

@derekmahar
Copy link
Author

derekmahar commented Jun 20, 2023

I run tidy-viewer on the following systems:

  • Ubuntu 22.04 in Windows Subsystem for Linux on a Windows 11 laptop
  • Ubuntu Server 22.04 on two Raspberry Pi 4s
  • Ubuntu Server 20.04 on an AMD Ryzen 3 1300X
  • Ubuntu Server 22.04 virtual machine running in Proxmox on an AMD Ryzen 9 6900HX

I would have installed it on an Alpine Linux container that is also running in Proxmox, but tidy-viewer isn't yet available in the Alpine Linux package repository and I haven't yet installed the Rust tool set in this container. I would have also installed it on my NAS running TrueNAS (FreeBSD) on an AMD A4-5300, but tidy-viewer isn't yet available in the FreeBSD ports tree, either. To run it on my NAS, I'll have to build tidy-viewer from source inside a FreeBSD jail and then install it in my TrueNAS home directory. Fortunately, I have such a FreeBSD jail whose main purpose is for building FreeBSD binaries.

tidy-viewer nicely complements the other CSV related tools that I use including csvq, csvtk, DuckDB, Miller, qsv, and SQLite.

@derekmahar
Copy link
Author

To run it on my NAS, I'll have to build tidy-viewer from source inside a FreeBSD jail and then install it in my TrueNAS home directory. Fortunately, I have such a FreeBSD jail whose main purpose is for building FreeBSD binaries.

Update: I built tidy-viewer from source inside a FreeBSD jail and installed it in $HOME/bin on my NAS.

[derek@truenas ~]$ uname -a
FreeBSD truenas.local 13.1-RELEASE-p7 FreeBSD 13.1-RELEASE-p7 n245418-79e75956dbb TRUENAS amd64
[derek@truenas ~]$ which tidy-viewer
/mnt/zdd/home/derek/bin/tidy-viewer
[derek@truenas ~]$ tidy-viewer --version
tv 1.4.30

@alexhallam
Copy link
Owner

I will look into a FreeBDS release. I am pushing this change to #166 . This comes with config file fixes and a new flag for checking which parameters have been picked up from the config. The idea came from #165

@derekmahar
Copy link
Author

derekmahar commented Jul 8, 2023

I built and tested the fix in tidy-viewer 1.5.2 in FreeBSD. Option --number-of-rows-to-output worked as I expected. I'm now waiting patiently for the Nix maintainers to release tidy-viewer 1.5.2 in branch nixos-unstable of flake nixpkgs so that I can test it on my Linux hosts which use the Nix package manager. If it takes too long, I might just build and install it using Cargo.

@derekmahar
Copy link
Author

I'm now waiting patiently for the Nix maintainers to release tidy-viewer 1.5.2 in branch nixos-unstable of flake nixpkgs so that I can test it on my Linux hosts which use the Nix package manager.

That was quick! Less than a day has passed and tidy-viewer 1.5.2 is already available in nixpkgs! Option --number-of-rows-to-output is working in that release, too:

$ tidy-viewer --number-of-rows-to-output 5 currency_exchange_rates.csv

        tv dim: 11903 x 4
        date                 source_currency_code target_currency_code exchange_rate
     1  1999-12-31T20:00:00Z PHP                  CAD                  0.0358
     2  1999-12-31T20:00:00Z USD                  CAD                  1.44
     3  2000-01-04T20:00:00Z PHP                  CAD                  0.0364
     4  2000-01-04T20:00:00Z USD                  CAD                  1.45
     5  2000-01-05T20:00:00Z PHP                  CAD                  0.037
        … with 11898 more rows

@alexhallam
Copy link
Owner

alexhallam commented Jul 9, 2023

I am going to see if cross can turn a binary into something compatible with FreeBSD. What is the file extension.

@derekmahar
Copy link
Author

File extension?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants