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

Add pager support #112

Closed
ismaelgv opened this issue Nov 17, 2021 · 8 comments
Closed

Add pager support #112

ismaelgv opened this issue Nov 17, 2021 · 8 comments

Comments

@ismaelgv
Copy link

It would be useful to have a pager mode that does not cuts the number of rows but lets you explore the data (including the colorization). This support could be inside the tool or just for external pagers such as less or bat.

I have tried to use less in a pipe but I lose the colors:

tidy-viewer data.csv -n 10000 -c 1 | less -R

Thanks for this awesome tool, great job here!

@alexhallam
Copy link
Owner

Thanks for opening this issue.

  1. The color loss with less is on purpose. We strip text of all color properties in this case. atty? #73
  2. I also want the ability to page, but tv will not be the tool for this. I have plans for another data tool that I hope will have pager-like support, but I don't want to say too much about that now because I need to test the viability.

@alexhallam
Copy link
Owner

As a side note, great repo https://github.com/ismaelgv/rnr!

@ismaelgv
Copy link
Author

Thanks for the quick response!

  1. The color loss with less is on purpose. We strip text of all color properties in this case. atty? #73

Maybe a new flag could be added to always keep the color (or just when color flag is explicitly set). This way the tv out can be piped to less with -R flag and keep the coloring with the pager.

If no flag is passed, it just keep the current behavior.

  1. I also want the ability to page, but tv will not be the tool for this. I have plans for another data tool that I hope will have pager-like support, but I don't want to say too much about that now because I need to test the viability.

Great, I am eager to check this new tool. ;)

@alexhallam
Copy link
Owner

alexhallam commented Nov 17, 2021

I think you are on to something.

I will block out some time to test a --force-color flag with the assumption that it will be piped to less -R.

@alexhallam
Copy link
Owner

alexhallam commented Nov 17, 2021

I just pushed a branch.

@ismaelgv Do you mind being a tester?

git clone https://github.com/alexhallam/tv/tree/force_color
cd tv
cargo build
./target/debug/tidy-viewer -a data/titanic.csv -n 1000 | less -R

@ismaelgv
Copy link
Author

@alexhallam works great. 😉

I've tested the new -a flag piping the results to less -R and bat -p. They both displays the colors correctly.

This should be more than enough to keep going. However, related to the other point that I initially included in the issue, should -n 0 (or something similar) display all lines instead of using a very large value (-n 1000)? Does it makes sense to you?

@alexhallam
Copy link
Owner

I see the logic in -n 0. I personally don’t think it is worth the additional feature.

@alexhallam
Copy link
Owner

#113

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