Skip to content

Commit 8cf4fc6

Browse files
committed
Updated readme for new sections
1 parent 89241ba commit 8cf4fc6

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

README.rst

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ of bugfixes in the Python version.
1616
- API has changed slightly. ``Docopt\docopt`` has been renamed to ``Docopt::handle``
1717
to fix autoloader support. See issue #3.
1818

19-
- Compatibility with Python master branch at commit `d5b96f878a <https://github.com/docopt/docopt/commit/d5b96f878abbda51b62f1e28010d2b42b19a27dc>`_
19+
- Compatibility with Python master branch at commit `d5b96f878a
20+
<https://github.com/docopt/docopt/commit/d5b96f878abbda51b62f1e28010d2b42b19a27dc>`_
2021

2122
- Potentially serious BC break in `issue 102 <https://github.com/docopt/docopt/issues/102>`_
2223

@@ -226,14 +227,24 @@ Help message consists of 2 sections:
226227
--quiet print less text
227228
--verbose print more text
228229

229-
Their format is described below; other text is ignored.
230+
Sections consist of a header and a body. The section body can begin on
231+
the same line as the header, but if it spans multiple lines, it must be
232+
indented. A section is terminated by an empty line or a string with no
233+
indentation::
234+
235+
Section header: Section body
236+
237+
Section header:
238+
Section body, which is indented at least
239+
one space or tab from the section header
240+
241+
Section header: Section body, which is indented at least
242+
one space or tab from the section header
230243

231244

232245
Usage section format
233246
----------------------------------------------------------------------
234247

235-
**Usage pattern** is a substring of ``doc`` that starts with
236-
``usage:`` (case *insensitive*) and ends with a *visibly* empty line.
237248
Minimum example::
238249

239250
Usage: my_program.php
@@ -315,11 +326,11 @@ I.e. invoked with ``my_program.php file1 file2 --path=./here
315326
['file1', 'file2']`` and ``args['--path'] == ['./here', './there']``.
316327

317328

318-
Option descriptions format
329+
Options section format
319330
----------------------------------------------------------------------
320331

321-
**Option descriptions** consist of a list of options that you put
322-
below your usage patterns.
332+
The **Option section** is an optional section that contains a list of
333+
options that can document or supplement your usage pattern.
323334

324335
It is necessary to list option descriptions in order to specify:
325336

@@ -329,8 +340,9 @@ It is necessary to list option descriptions in order to specify:
329340

330341
The rules are as follows:
331342

332-
- Every line in ``doc`` that starts with ``-`` or ``--`` (not counting
333-
spaces) is treated as an option description, e.g.::
343+
- Every line in the options section body that starts with one or more
344+
horizontal whitespace characters, followed by ``-`` or ``--``is treated
345+
as an option description, e.g.::
334346
335347
Options:
336348
--verbose # GOOD

0 commit comments

Comments
 (0)