Return a pager command. Makes some attempts at finding an OS-correct one.
(pager_cmd=None)
| 281 | |
| 282 | |
| 283 | def get_pager_cmd(pager_cmd=None): |
| 284 | """Return a pager command. |
| 285 | |
| 286 | Makes some attempts at finding an OS-correct one. |
| 287 | """ |
| 288 | if os.name == 'posix': |
| 289 | default_pager_cmd = 'less -R' # -R for color control sequences |
| 290 | elif os.name in ['nt','dos']: |
| 291 | default_pager_cmd = 'type' |
| 292 | |
| 293 | if pager_cmd is None: |
| 294 | try: |
| 295 | pager_cmd = os.environ['PAGER'] |
| 296 | except: |
| 297 | pager_cmd = default_pager_cmd |
| 298 | |
| 299 | if pager_cmd == 'less' and '-r' not in os.environ.get('LESS', '').lower(): |
| 300 | pager_cmd += ' -R' |
| 301 | |
| 302 | return pager_cmd |
| 303 | |
| 304 | |
| 305 | def get_pager_start(pager, start): |
no outgoing calls
no test coverage detected