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

Feature request: Set max list length when using fancy_grid #57

Closed
r-bhikhie opened this issue May 13, 2020 · 2 comments
Closed

Feature request: Set max list length when using fancy_grid #57

r-bhikhie opened this issue May 13, 2020 · 2 comments
Labels
duplicate This issue or pull request already exists wontfix This will not be worked on

Comments

@r-bhikhie
Copy link

r-bhikhie commented May 13, 2020

Is there any way to set a max number of items before the script draws a second table to the right of the first one?

If I have say, 50 items which are being listed in fancy_grid mode, ideally I want to display only 15 to 20 before my terminal runs out of vertical space.
So being able to give a parameter like "max_list_length=20" would be a nice option to have.

Thank you!

@r-bhikhie r-bhikhie changed the title Feature request: Set max list lenght when using fancy_grid Feature request: Set max list length when using fancy_grid May 13, 2020
@kumareshr
Copy link

Really this request can come handy because long list character actually spoils the purpose of this module. if we able trim the characters would great.

@astanin
Copy link
Owner

astanin commented Feb 20, 2021

This library is used in all sorts of contexts, interactive and non-interactive. If you want to paginate output, extract a slice of your data and pass it to tabulate() function.

So let's say you have a data with 50 rows, page size 5, and want to print the 4th page (0-indexed):

>>> data = [["text", i] for i in range(1, 50)]
>>> pagesize = 5
>>> print(tabulate(data[pagesize*3:pagesize*3+pagesize]))
----  --
text  16
text  17
text  18
text  19
text  20
----  --

The burden of getting user input to go to the next/previous page is out of scope of this library.

This is a duplicate of #88.

@astanin astanin closed this as completed Feb 20, 2021
@astanin astanin added duplicate This issue or pull request already exists wontfix This will not be worked on labels Feb 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants