diff options
| author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-03-07 19:57:28 -0500 |
|---|---|---|
| committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-03-07 19:57:28 -0500 |
| commit | d731cff17b5ef78431ca2e8453b35b9fc05a5dbe (patch) | |
| tree | 5dfab206391b0cb36e4e459c601099a8b56c97df /cmd2.py | |
| parent | 5cc434b0150e38252bc6eaba91825805db08e5a4 (diff) | |
| download | cmd2-git-d731cff17b5ef78431ca2e8453b35b9fc05a5dbe.tar.gz | |
Refactored the Windows vs macOS/Linux conditional in ppaged()
Aslo:
- Added some documentation for ppaged()
- Updated CHANGELOG
- Added line about ppaged() in README
Diffstat (limited to 'cmd2.py')
| -rwxr-xr-x | cmd2.py | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -1229,14 +1229,15 @@ class Cmd(cmd.Cmd): # Don't attempt to use a pager that can block if redirecting or running a script (either text or Python) if not self.redirecting and not self._in_py and not self._script_dir: - # Here is the meaning of the various flags we are using with the less command: - # -S causes lines longer than the screen width to be chopped (truncated) rather than wrapped - # -R causes ANSI "color" escape sequences to be output in raw form (i.e. colors are displayed) - # -X disables sending the termcap initialization and deinitialization strings to the terminal - # -F causes less to automatically exit if the entire file can be displayed on the first screen - pager_cmd = 'less -SRXF' if sys.platform.startswith('win'): pager_cmd = 'more' + else: + # Here is the meaning of the various flags we are using with the less command: + # -S causes lines longer than the screen width to be chopped (truncated) rather than wrapped + # -R causes ANSI "color" escape sequences to be output in raw form (i.e. colors are displayed) + # -X disables sending the termcap initialization and deinitialization strings to the terminal + # -F causes less to automatically exit if the entire file can be displayed on the first screen + pager_cmd = 'less -SRXF' self.pipe_proc = subprocess.Popen(pager_cmd, shell=True, stdin=subprocess.PIPE) try: self.pipe_proc.stdin.write(msg_str.encode('utf-8', 'replace')) |
