cmd: indicate multiple named args in usage banner

This commit is contained in:
Dawid Dziurla 2021-01-15 13:04:00 +01:00
parent bca4804a9e
commit 332372469f
No known key found for this signature in database
GPG Key ID: 7B6D8368172E9B0B
33 changed files with 34 additions and 38 deletions

View File

@ -16,7 +16,7 @@ module Homebrew
def __cache_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`--cache` [<options>] [<formula>|<cask>]
`--cache` [<options>] [<formula>|<cask>] [<formula>|<cask> ...]
Display Homebrew's download cache. See also `HOMEBREW_CACHE`.

View File

@ -10,7 +10,7 @@ module Homebrew
def __caskroom_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`--caskroom` [<cask>]
`--caskroom` [<cask>] [<cask> ...]
Display Homebrew's Caskroom path.

View File

@ -9,7 +9,7 @@ module Homebrew
def __cellar_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`--cellar` [<formula>]
`--cellar` [<formula>] [<formula> ...]
Display Homebrew's Cellar path. *Default:* `$(brew --prefix)/Cellar`, or if
that directory doesn't exist, `$(brew --repository)/Cellar`.

View File

@ -15,7 +15,7 @@ module Homebrew
def __env_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`--env` [<options>] [<formula>]
`--env` [<options>] [<formula>] [<formula> ...]
Summarise Homebrew's build environment as a plain list.

View File

@ -12,7 +12,7 @@ module Homebrew
def __prefix_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`--prefix` [<formula>]
`--prefix` [<formula>] [<formula> ...]
Display Homebrew's install path. *Default:*

View File

@ -12,7 +12,7 @@ module Homebrew
def __repository_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`--repository`, `--repo` [<user>`/`<repo>]
`--repository`, `--repo` [<user>`/`<repo>] [<user>`/`<repo> ...]
Display where Homebrew's `.git` directory is located.

View File

@ -14,7 +14,7 @@ module Homebrew
Homebrew::CLI::Parser.new do
days = Homebrew::EnvConfig::ENVS[:HOMEBREW_CLEANUP_MAX_AGE_DAYS][:default]
usage_banner <<~EOS
`cleanup` [<options>] [<formula>|<cask>]
`cleanup` [<options>] [<formula>|<cask>] [<formula>|<cask> ...]
Remove stale lock files and outdated downloads for all formulae and casks,
and remove old versions of installed formulae. If arguments are specified,

View File

@ -18,7 +18,7 @@ module Homebrew
def deps_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`deps` [<options>] [<formula>]
`deps` [<options>] [<formula>] [<formula> ...]
Show dependencies for <formula>. Additional options specific to <formula>
may be appended to the command. When given multiple formula arguments,

View File

@ -17,7 +17,7 @@ module Homebrew
def desc_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`desc` [<options>] (<text>|`/`<text>`/`|<formula>)
`desc` [<options>] <text>|`/`<text>`/`|<formula> [<text>|`/`<text>`/`|<formula> ...]
Display <formula>'s name and one-line description.
Formula descriptions are cached; the cache is created on the
@ -35,7 +35,7 @@ module Homebrew
conflicts "--search", "--name", "--description"
named_args :formula
named_args :formula, min: 1
end
end
@ -51,14 +51,10 @@ module Homebrew
end
results = if search_type.nil?
raise FormulaUnspecifiedError if args.no_named?
desc = {}
args.named.to_formulae.each { |f| desc[f.full_name] = f.desc }
Descriptions.new(desc)
else
raise UsageError, "this command requires a search term" if args.no_named?
query = args.named.join(" ")
string_or_regex = query_regexp(query)
CacheStoreDatabase.use(:descriptions) do |db|

View File

@ -17,7 +17,7 @@ module Homebrew
def fetch_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`fetch` [<options>] <formula>
`fetch` [<options>] <formula>|<cask> [<formula>|<cask> ...]
Download a bottle (if available) or source packages for <formula>e
and binaries for <cask>s. For files, also print SHA-256 checksums.

View File

@ -13,7 +13,7 @@ module Homebrew
def home_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`home` [<formula>|<cask>]
`home` [<formula>|<cask>] [<formula>|<cask> ...]
Open a <formula> or <cask>'s homepage in a browser, or open
Homebrew's own homepage if no argument is provided.

View File

@ -25,7 +25,7 @@ module Homebrew
def info_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`info` [<options>] [<formula>|<cask>]
`info` [<options>] [<formula>|<cask>] [<formula>|<cask> ...]
Display brief statistics for your Homebrew installation.

View File

@ -24,7 +24,7 @@ module Homebrew
def install_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`install` [<options>] <formula>|<cask>
`install` [<options>] <formula>|<cask> [<formula>|<cask> ...]
Install a <formula> or <cask>. Additional options specific to a <formula> may be
appended to the command.

View File

@ -15,7 +15,7 @@ module Homebrew
def link_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`link`, `ln` [<options>] <formula>
`link`, `ln` [<options>] <formula> [<formula> ...]
Symlink all of <formula>'s installed files into Homebrew's prefix. This
is done automatically when you install formulae but can be useful for DIY

View File

@ -15,7 +15,7 @@ module Homebrew
def list_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`list`, `ls` [<options>] [<formula>|<cask>]
`list`, `ls` [<options>] [<formula>|<cask>] [<formula>|<cask> ...]
List all installed formulae and casks.

View File

@ -13,7 +13,7 @@ module Homebrew
def migrate_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`migrate` [<options>] <formula>
`migrate` [<options>] <formula> [<formula> ...]
Migrate renamed packages to new names, where <formula> are old names of
packages.

View File

@ -15,7 +15,7 @@ module Homebrew
def missing_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`missing` [<options>] [<formula>]
`missing` [<options>] [<formula>] [<formula> ...]
Check the given <formula> kegs for missing dependencies. If no <formula> are
provided, check all kegs. Will exit with a non-zero status if any kegs are found

View File

@ -15,7 +15,7 @@ module Homebrew
def options_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`options` [<options>] [<formula>]
`options` [<options>] [<formula>] [<formula> ...]
Show install options specific to <formula>.
EOS

View File

@ -16,7 +16,7 @@ module Homebrew
def outdated_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`outdated` [<options>] [<formula>|<cask>]
`outdated` [<options>] [<formula>|<cask>] [<formula>|<cask> ...]
List installed casks and formulae that have an updated version available. By default, version
information is displayed in interactive shells, and suppressed otherwise.

View File

@ -13,7 +13,7 @@ module Homebrew
def pin_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`pin` <formula>
`pin` <formula> [<formula> ...]
Pin the specified <formula>, preventing them from being upgraded when
issuing the `brew upgrade` <formula> command. See also `unpin`.

View File

@ -14,7 +14,7 @@ module Homebrew
def postinstall_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`postinstall` <formula>
`postinstall` <formula> [<formula> ...]
Rerun the post-install steps for <formula>.
EOS

View File

@ -13,7 +13,7 @@ module Homebrew
def readall_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`readall` [<options>] [<tap>]
`readall` [<options>] [<tap>] [<tap> ...]
Import all items from the specified <tap>, or from all installed taps if none is provided.
This can be useful for debugging issues across all items when making

View File

@ -22,7 +22,7 @@ module Homebrew
def reinstall_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`reinstall` [<options>] <formula>|<cask>
`reinstall` [<options>] <formula>|<cask> [<formula>|<cask> ...]
Uninstall and then reinstall a <formula> or <cask> using the same options it was
originally installed with, plus any appended options specific to a <formula>.

View File

@ -31,7 +31,7 @@ module Homebrew
def search_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`search` [<options>] [<text>|`/`<text>`/`]
`search` [<options>] [<text>|`/`<text>`/`] [<text>|`/`<text>`/` ...]
Perform a substring search of cask tokens and formula names for <text>. If <text>
is flanked by slashes, it is interpreted as a regular expression.

View File

@ -19,7 +19,7 @@ module Homebrew
Symlink all of the specified <version> of <formula>'s installation into Homebrew's prefix.
EOS
named 2
named_args number: 2
hide_from_man_page!
end
end

View File

@ -12,7 +12,7 @@ module Homebrew
def tap_info_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`tap-info` [<options>] [<tap>]
`tap-info` [<options>] [<tap>] [<tap> ...]
Show detailed information about one or more <tap>s.

View File

@ -19,7 +19,7 @@ module Homebrew
def uninstall_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`uninstall`, `rm`, `remove` [<options>] <formula>|<cask>
`uninstall`, `rm`, `remove` [<options>] <formula>|<cask> [<formula>|<cask> ...]
Uninstall a <formula> or <cask>.
EOS

View File

@ -14,7 +14,7 @@ module Homebrew
def unlink_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`unlink` [<options>] <formula>
`unlink` [<options>] <formula> [<formula> ...]
Remove symlinks for <formula> from Homebrew's prefix. This can be useful
for temporarily disabling a formula:

View File

@ -13,7 +13,7 @@ module Homebrew
def unpin_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`unpin` <formula>
`unpin` <formula> [<formula> ...]
Unpin <formula>, allowing them to be upgraded by `brew upgrade` <formula>.
See also `pin`.

View File

@ -12,7 +12,7 @@ module Homebrew
def untap_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`untap` <tap>
`untap` <tap> [<tap> ...]
Remove a tapped formula repository.
EOS

View File

@ -1,4 +1,4 @@
#: * `update-reset` [<repository>]
#: * `update-reset` [<repository>] [<repository> ...]
#:
#: Fetch and reset Homebrew and all tap repositories (or any specified <repository>) using `git`(1) to their latest `origin/master`.
#:

View File

@ -18,7 +18,7 @@ module Homebrew
def upgrade_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`upgrade` [<options>] [<formula>|<cask>]
`upgrade` [<options>] [<formula>|<cask>] [<formula>|<cask> ...]
Upgrade outdated casks and outdated, unpinned formulae using the same options they were originally
installed with, plus any appended brew formula options. If <cask> or <formula> are specified,

View File

@ -21,7 +21,7 @@ module Homebrew
def uses_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`uses` [<options>] <formula>
`uses` [<options>] <formula> [<formula> ...]
Show formulae and casks that specify <formula> as a dependency (i.e. show dependents
of <formula>). When given multiple formula arguments, show the intersection