manzt / juv

Reproducible Jupyter notebooks, powered by uv.
MIT License
80 stars 2 forks source link

Add `--pager` flag for `juv cat` #45

Closed manzt closed 2 weeks ago

manzt commented 2 weeks ago

This PR introduces a --pager flag to the juv cat command, allowing users to specify a custom pager tool for displaying the notebook’s contents. If the --pager flag is not provided, juv cat will default to the JUV_PAGER environment variable (if set).

When JUV_PAGER (or --pager) is set to bat, additional flags are automatically added to improve formatting, including syntax highlighting with an inferred file type based on notebook content (e.g., markdown or script).

This setup achieves the same effect as manually piping to bat if installed:

juv cat Untitled.ipynb | bat --language md --file-name 'Untitled.md'

or

juv cat Untitled.ipynb --script | bat --langugage py --file-name 'Untitled.py'