string: Quit early if --quiet is satisfied

E.g. if we do `string match -q`, and we find a match, nothing about
the input can change anything, so we quit early.

This is mainly useful for performance, but it also allows `string`
with `-q` to be used with infinite input (e.g. `yes`).

Alternative to #7495.
This commit is contained in:
Fabian Homborg
2020-11-29 12:06:48 +01:00
parent 8f165ab26b
commit 720982a3cb
3 changed files with 29 additions and 1 deletions

View File

@@ -34,7 +34,7 @@ STRING arguments are taken from the command line unless standard input is connec
Arguments beginning with ``-`` are normally interpreted as switches; ``--`` causes the following arguments not to be treated as switches even if they begin with ``-``. Switches and required arguments are recognized only on the command line.
Most subcommands accept a ``-q`` or ``--quiet`` switch, which suppresses the usual output but exits with the documented status.
Most subcommands accept a ``-q`` or ``--quiet`` switch, which suppresses the usual output but exits with the documented status. In this case these commands will quit early, without reading all of the available input.
The following subcommands are available.