Render help content on a Posix-like system. This includes Linux and MacOS X.
| 233 | |
| 234 | |
| 235 | class PosixHelpRenderer(PosixPagingHelpRenderer): |
| 236 | """ |
| 237 | Render help content on a Posix-like system. This includes |
| 238 | Linux and MacOS X. |
| 239 | """ |
| 240 | |
| 241 | def _convert_doc_content(self, contents): |
| 242 | settings_overrides = self._DEFAULT_DOCUTILS_SETTINGS_OVERRIDES.copy() |
| 243 | settings_overrides["report_level"] = 3 |
| 244 | man_contents = publish_string( |
| 245 | contents, |
| 246 | writer=manpage.Writer(), |
| 247 | settings_overrides=self._DEFAULT_DOCUTILS_SETTINGS_OVERRIDES, |
| 248 | ) |
| 249 | if self._exists_on_path('groff'): |
| 250 | cmdline = ['groff', '-m', 'man', '-T', 'ascii'] |
| 251 | elif self._exists_on_path('mandoc'): |
| 252 | cmdline = ['mandoc', '-T', 'ascii'] |
| 253 | else: |
| 254 | raise ExecutableNotFoundError('groff or mandoc') |
| 255 | LOG.debug("Running command: %s", cmdline) |
| 256 | p3 = self._popen(cmdline, stdin=PIPE, stdout=PIPE, stderr=PIPE) |
| 257 | output = p3.communicate(input=man_contents)[0] |
| 258 | return output |
| 259 | |
| 260 | |
| 261 | class PosixBrowserHelpRenderer(BrowserHelpRenderer): |
no outgoing calls