pydoc-use-pager
authorMatthias Klose <doko@debian.org>
Fri, 5 Feb 2021 13:46:56 +0000 (13:46 +0000)
committerMatthias Klose <doko@debian.org>
Fri, 5 Feb 2021 13:46:56 +0000 (13:46 +0000)
# DP: pydoc: use the pager command if available.

# DP: pydoc: use the pager command if available.

Gbp-Pq: Name pydoc-use-pager.diff

Lib/pydoc.py

index 0a207598e95e08ca3bea4c456bd5c9df8178258d..47bce2157d03c9dc5e1d94856721ed308a0ff2ed 100755 (executable)
@@ -1578,6 +1578,8 @@ def getpager():
         return plainpager
     if sys.platform == 'win32':
         return lambda text: tempfilepager(plain(text), 'more <')
+    if hasattr(os, 'system') and os.system('(pager) 2>/dev/null') == 0:
+        return lambda text: pipepager(text, 'pager')
     if hasattr(os, 'system') and os.system('(less) 2>/dev/null') == 0:
         return lambda text: pipepager(text, 'less')