diff options
| -rw-r--r-- | docs/manifest-format.md | 1 | ||||
| -rw-r--r-- | subcmds/help.py | 21 |
2 files changed, 14 insertions, 8 deletions
diff --git a/docs/manifest-format.md b/docs/manifest-format.md index aa1580d9..da83d0dd 100644 --- a/docs/manifest-format.md +++ b/docs/manifest-format.md | |||
| @@ -21,6 +21,7 @@ following DTD: | |||
| 21 | 21 | ||
| 22 | ```xml | 22 | ```xml |
| 23 | <!DOCTYPE manifest [ | 23 | <!DOCTYPE manifest [ |
| 24 | |||
| 24 | <!ELEMENT manifest (notice?, | 25 | <!ELEMENT manifest (notice?, |
| 25 | remote*, | 26 | remote*, |
| 26 | default?, | 27 | default?, |
diff --git a/subcmds/help.py b/subcmds/help.py index 9ba9e706..6a767e6f 100644 --- a/subcmds/help.py +++ b/subcmds/help.py | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | import re | 15 | import re |
| 16 | import sys | 16 | import sys |
| 17 | from formatter import AbstractFormatter, DumbWriter | 17 | import textwrap |
| 18 | 18 | ||
| 19 | from subcmds import all_commands | 19 | from subcmds import all_commands |
| 20 | from color import Coloring | 20 | from color import Coloring |
| @@ -84,8 +84,7 @@ Displays detailed usage information about a command. | |||
| 84 | def __init__(self, gc): | 84 | def __init__(self, gc): |
| 85 | Coloring.__init__(self, gc, 'help') | 85 | Coloring.__init__(self, gc, 'help') |
| 86 | self.heading = self.printer('heading', attr='bold') | 86 | self.heading = self.printer('heading', attr='bold') |
| 87 | 87 | self._first = True | |
| 88 | self.wrap = AbstractFormatter(DumbWriter()) | ||
| 89 | 88 | ||
| 90 | def _PrintSection(self, heading, bodyAttr): | 89 | def _PrintSection(self, heading, bodyAttr): |
| 91 | try: | 90 | try: |
| @@ -95,7 +94,9 @@ Displays detailed usage information about a command. | |||
| 95 | if body == '' or body is None: | 94 | if body == '' or body is None: |
| 96 | return | 95 | return |
| 97 | 96 | ||
| 98 | self.nl() | 97 | if not self._first: |
| 98 | self.nl() | ||
| 99 | self._first = False | ||
| 99 | 100 | ||
| 100 | self.heading('%s%s', header_prefix, heading) | 101 | self.heading('%s%s', header_prefix, heading) |
| 101 | self.nl() | 102 | self.nl() |
| @@ -105,7 +106,8 @@ Displays detailed usage information about a command. | |||
| 105 | body = body.strip() | 106 | body = body.strip() |
| 106 | body = body.replace('%prog', me) | 107 | body = body.replace('%prog', me) |
| 107 | 108 | ||
| 108 | asciidoc_hdr = re.compile(r'^\n?#+ (.+)$') | 109 | # Extract the title, but skip any trailing {#anchors}. |
| 110 | asciidoc_hdr = re.compile(r'^\n?#+ ([^{]+)(\{#.+\})?$') | ||
| 109 | for para in body.split("\n\n"): | 111 | for para in body.split("\n\n"): |
| 110 | if para.startswith(' '): | 112 | if para.startswith(' '): |
| 111 | self.write('%s', para) | 113 | self.write('%s', para) |
| @@ -120,9 +122,12 @@ Displays detailed usage information about a command. | |||
| 120 | self.nl() | 122 | self.nl() |
| 121 | continue | 123 | continue |
| 122 | 124 | ||
| 123 | self.wrap.add_flowing_data(para) | 125 | lines = textwrap.wrap(para.replace(' ', ' '), width=80, |
| 124 | self.wrap.end_paragraph(1) | 126 | break_long_words=False, break_on_hyphens=False) |
| 125 | self.wrap.end_paragraph(0) | 127 | for line in lines: |
| 128 | self.write('%s', line) | ||
| 129 | self.nl() | ||
| 130 | self.nl() | ||
| 126 | 131 | ||
| 127 | out = _Out(self.client.globalConfig) | 132 | out = _Out(self.client.globalConfig) |
| 128 | out._PrintSection('Summary', 'helpSummary') | 133 | out._PrintSection('Summary', 'helpSummary') |
