[ANN] TerminalPager.jl v0.2.0

Hi!

I just tagged a new version of TerminalPager.jl with minor updates.

We have now two macros to help. The first one is called @dpr and can be used to access any documentation inside the pager:

julia> @dpr write

The second one is called @stdout_to_pager and can be used to redirect all stdout to the pager:

julia> @stdout_to_pager for i = 1:100
       println("$(mod(i,9))"^i)
       end

We now also have a vertical ruler that can be toggle by hitting r:

36 Likes

This looks really nice, I hope something like that gets in Base at some point…

What about naming the macro @help instead of @dpr? (what does @dpr stand for?)

1 Like

It is great, I use julia in terminal frequently, and @dpr is very useful for reading documentation :slight_smile: .

1 Like

Thanks! Let’s see if I can make everything works fine to propose it to be merged into stdlib. My current problem is how to create tests.

@dpr stands for “docs pager”. I did not use @help since it is a very common name and can interfere with some existing codes.

Nice! :slight_smile:

1 Like

But wouldn’t this other @help macro most probably do a similar thing (meaning it’s unlikely that a user would use both)? To me it sounds a bit like an interpolation package that doesn’t want to define interpolate because it could clash with other interpolation implementations :slight_smile: .

3 Likes

hum, good point. I will think about it :slight_smile:

3 Likes

So why this was a breaking change? I don’t see any breaking change in the ChangeLog either

It is not, but I thought I had to increment the minor version (pre-1.0) if I add a new feature. In this case, we have two new macros. Am I wrong?

Yes: PSA: If your package's version is of the form `0.y.z`, please do NOT bump the minor version for new features.

The semver world is much easier if you use all three numbers instead of restraining yourself to just two: How can we encourage Julia package developers to release version 1.0.0?.

4 Likes

Oops, sorry :sweat_smile: I read that, but I confused minor version with the patch version.

Yes, you are right. I just need to stabilize things and create a good set of tests before tagging 1.0.

2 Likes

I think you are right :slight_smile: I just tagged the v0.2.1 with @dpr replaced by @help. The old name is now deprecated.

3 Likes

This is great!

I think that the screenshot below the code

julia> @stdout_to_pager for i = 1:100
       println("$(mod(i,9))"^i)
       end

Is for a different example where you print a random 100x100 matrix.

Also, do you have any plans to make this a REPL mode? That way when you are using TerminalPager, you could hit a key to enter the pager mode, where all outputs are sent to the pager. Similar to how ? and ] work with the help and the package manager right now.

1 Like

Thanks!

Really? Everything seems right here. Can you please refresh the page?

What an amazing idea! I will see if I can do this :slight_smile:

The example displayed in announcement above seems to be the one in the package usage section:
rand(100,100) |> pager

@Ronis_BR, the key “freeze panes” functionality (say, freeze 1 row and 1 column) does not seem to be working on TerminalPager v0.2.1 and Julia 1.6.1.
(both Win10 and linux)

Could you please verify? Thank you.

It is working here. I entered in the pager and typed f, then the command line as for the number of rows and columns to freeze. Can you please describe what you are doing?

After digging into the internals of Pkg.jl, I could create a REPL mode! In this case, it should works just like the julia command line for all output that fits on the screen. If the output is larger, then if uses the pager.

In this case, I am getting the output from display of the returned object and also everything that was printed to stdout. Hence, pretty_table will also work here.

Gravação de Tela 2021-05-23 às 14.06.59

I just need to polish it a little bit because some functionalities are not working, like pasting commands with julia> prefix.

P.S.: The REPL stdlib is very nice and the customization options are amazing! It just need better documentation. I will add it to my todo list.
There are so many nice things that can be done with those modes!

11 Likes

Here it goes:

rand(100,100) |> pager
:f
Freeze rows (0): 1
Freeze columns (0): 1

then used the keyboard arrows to move around the table but no freeze effect is observed.

NB: tried also with no avail (in terms of freezing):
DataFrame(rand(100,100),:auto) |> pager

It worked here. Notice that the first column is frozen and the first line also. The first column in this example contains 1 in the first row and only spaces afterwards. The first line is being shown even though we are not at the first line. Can you provide a screenshot?