ronisbr / TerminalPager.jl

Pure Julia implementation of the command less
MIT License
116 stars 8 forks source link

add an option to have custom recipes to pager #11

Open bkamins opened 3 years ago

bkamins commented 3 years ago

This is a general request but what I specifically mean is that if e.g. you do:

DataFrame(rand(100, 100), :auto) |> pager

that it would be possible that recipe would be registered by DataFrames.jl that would by default freeze the "Row" columns and header appropriately. The key thing here is that this recipe would need to be able to properly calculate the number of rows/columns to freeze (currently you have manually count e.g. the width of "Row" column to properly freeze it)

bkamins commented 3 years ago

Ah - maybe we can just have a custom pager method in DataFrames.jl once TerminalPager.jl becomes part of PrettyTables.jl and is imported by DataFrames.jl.

ronisbr commented 3 years ago

Good point. Currently, we can specify the initial freeze using keywords of pager functions. We can also remove the feature that allows the user to change it dynamically. Thus we can compute the size necessary inside DataFrame and call pager with the right numbers. Seems good?

P.S.: By the way, thank you for your contributions here, you always have good comments :)

bkamins commented 3 years ago

Thus we can compute the size necessary inside DataFrame and call pager with the right numbers.

This is what I assumed.

We can also remove the feature that allows the user to change it dynamically.

This is OK to keep. It is just important to have a reasonable default when invoking pager.