A $PAGER in pure Python
pip install pypager
Pypager can be used as a stand-alone application, or as a library.
FeaturesHighlighting of text [0].
Searching.
Many key bindings from less are implemented.
[0] (It understands the output of man pages, ANSI escape codes and further, it can use Pygments to highlight about any file.)
Usage# Install it.
pip install pypager
# Tell the environment to use this pager. Put the following line in
# ~/.bashrc if you like.
export PAGER=pypager
# Following commands, and many others should pick up the pager.
man vim
git diff
# View a file, using this pager.
pypager some_source_code.py
As a library
from pypager.source import GeneratorSource
from pypager.pager import Pager
def generate_a_lot_of_content():
"""
This is a function that generates content on the fly.
It's called when the pager needs to display more content.
This should yield prompt_toolkit `(style_string, text)` tuples.
"""
counter = 0
while True:
yield [("", 'line: %i\n' % counter)]
counter += 1
if __name__ == '__main__':
p = Pager()
p.add_source(GeneratorSource(generate_a_lot_of_content())
p.run()
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution Built DistributionRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4