Also prepend "./" for filter if a filename starts with "-"

This is now added to the two commands that definitely deal with
relative paths.

It doesn't work for e.g. `path basename`, because after removing the
dirname prepending a "./" doesn't refer to the same file, and the
basename is also expected to not contain any slashes.
This commit is contained in:
Fabian Homborg
2022-05-11 17:00:59 +02:00
parent c88f648cdf
commit bc3d3de30a
3 changed files with 16 additions and 1 deletions

View File

@@ -170,6 +170,8 @@ The filter options can either be given as multiple options, or comma-separated -
With ``--invert``, the meaning of the filtering is inverted - any path that wouldn't pass (including by not existing) passes, and any path that would pass fails.
When a path starts with ``-``, ``path filter`` will prepend ``./`` to avoid it being interpreted as an option otherwise.
It returns 0 if at least one path passed the filter.
``path is`` is shorthand for ``path filter -q``, i.e. just checking without producing output, see :ref:`The is subcommand <cmd-path-is>`.