[ANN] TerminalPager.jl: REPL inline help added

Version 0.6.8 of TerminalPager.jl adds an inline about functionality close in spirit to the inline help of this Discourse topic.

After loading both About.jl and TerminalPager.jl (e.g. in your startup) and positioning your REPL text cursor on any identifier you cannot only get help with <alt>+<h>, but you get the output from about with <alt>+<a>. It’s both shown in a pager, so you get back to where you were after pressing <q>.

If, for example, you want to use a lazy iterator, you might be tempted to enter Iterators followed by <alt>+<h> just to be disappointed by this return

search: Iterators Base.IteratorSize numerator iterate Base.IteratorEltype Base.Generator

  Methods for working with Iterators.

which creates appetite for more, but can’t satisfy it.

You could have entered Iterators. followed by <tab>, but then you get

julia> Iterators.

Accumulate                 Base                       Count                      Cycle
Drop                       DropWhile                  Enumerate                  Filter
Flatten                    IterableStatePairs         IterationCutShort          PartitionIterator
ProductIterator            Repeated                   Rest                       Reverse
Stateful                   Take                       TakeWhile                  Zip
_approx_iter_type          _diff_length               _flatten_iteratorsize      _flatteneltype
_min_length                _only                      _pairs_elt                 _pisdone
_piterate                  _piterate1                 _prod_axes1                _prod_eltype
_prod_indices              _prod_size                 _prod_size1                _promote_tuple_shape
_zip_any_isdone            _zip_isdone                _zip_iterate_all           _zip_iterate_interleave
_zip_iterate_some          _zip_lengths_finite_equal  _zip_min_length            accumulate
and_iteratoreltype         and_iteratorsize           approx_iter_type           convert
countfrom                  cycle                      doiterate                  drop
drop_iteratorsize          dropwhile                  enumerate                  filter
flatmap                    flatten                    flatten_iteratorsize       flatten_length
map                        only                       partition                  partition_iteratorsize
peel                       prod_iteratorsize          product                    repeated
reset!                     rest                       rest_iteratorsize          reverse
take                       take_iteratorsize          takewhile                  zip
zip_iteratoreltype         zip_iteratorsize

which

  • is hard to grasp due to the amount of information
  • contains a lot of internal helper functions which should rarely be useful to the user
  • does not show what is public API
  • will typically scroll at least parts or your previous session out of view.

I think it’s better to enter Iterators followed by <alt>+<a> to get this:

Module Base.Iterators

Re-exports 21 names (from Base):
• Iterators   • drop       • flatmap    • peel      • reverse    • Stateful
• accumulate  • dropwhile  • flatten    • product   • take     
• countfrom   • enumerate  • map        • repeated  • takewhile
• cycle       • filter     • partition  • rest      • zip

This does not even do it justice, as in the REPL it will be nicely formatted and colored.

You can, of course, use it on all the other things About.jl supports, which is basically everything in Julia.

Technically, I implemented it as a package extension for About.jl inside of TerminalPager.jl using a bit of glue code to connect the functionality of both.

Thanks to @tecosaur and to @Ronis_BR for creating great packages with About.jl and TerminalPager.jl, respectively, doing the majority of the work!

14 Likes