Skip to content

Commit e2e4ff4

Browse files
authored
Update documentation for path argument parsing (#804)
1 parent e40bf53 commit e2e4ff4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

DOCUMENTATION.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,8 @@ using the :py:meth:`.Path.get_content` method. For the previous example would be
669669
``info_db = cfg.databases.info.get_content()``.
670670

671671
An argument with a path type can be given ``nargs='+'`` to parse multiple paths.
672+
The CLI syntax for a list of paths is ``[/path/a,/path/b]`` for the default yaml
673+
loader and ``["/path/a","/path/b"]`` for the json loader.
672674
But it might also be wanted to parse a list of paths found in a plain text file
673675
or from stdin. For this add the argument with type ``List[<path_type>]`` and
674676
``enable_path=True``. To read from stdin give the special string ``'-'``.
@@ -703,6 +705,10 @@ Example:
703705
If ``nargs='+'`` is given to ``add_argument`` with ``List[<path_type>]`` and
704706
``enable_path=True`` then for each argument a list of paths is generated.
705707

708+
Path list arguments can also be specified using the
709+
:py:meth:`.ArgumentParser.add_class_arguments` method. To do so, specify
710+
``List[<path_type>]`` as your class member's type.
711+
706712
.. note::
707713

708714
Not all features of the :class:`.Path` class are supported on Windows.

0 commit comments

Comments
 (0)