cmd/deps: improve switch names.

The previous `-n` and `--1` made both the code and the help harder to
read and follow.

Co-authored-by: Eric Knibbe <enk3@outlook.com>
Co-Authored-By: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
This commit is contained in:
Mike McQuaid 2022-08-31 17:21:44 +01:00
parent d724616edf
commit fd432aa1db
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829
6 changed files with 17 additions and 17 deletions

View File

@ -22,10 +22,10 @@ module Homebrew
may be appended to the command. When given multiple formula arguments, may be appended to the command. When given multiple formula arguments,
show the intersection of dependencies for each formula. show the intersection of dependencies for each formula.
EOS EOS
switch "-n", switch "-n", "--topological",
description: "Sort dependencies in topological order." description: "Sort dependencies in topological order."
switch "--1", switch "-1", "--direct", "--declared", "--1",
description: "Only show dependencies one level down, instead of recursing." description: "Show only the direct dependencies declared in the formula."
switch "--union", switch "--union",
description: "Show the union of dependencies for multiple <formula>, instead of the intersection." description: "Show the union of dependencies for multiple <formula>, instead of the intersection."
switch "--full-name", switch "--full-name",
@ -81,7 +81,7 @@ module Homebrew
Formulary.enable_factory_cache! Formulary.enable_factory_cache!
recursive = !args.send(:"1?") recursive = !args.direct?
installed = args.installed? || dependents(args.named.to_formulae_and_casks).all?(&:any_version_installed?) installed = args.installed? || dependents(args.named.to_formulae_and_casks).all?(&:any_version_installed?)
@use_runtime_dependencies = installed && recursive && @use_runtime_dependencies = installed && recursive &&
@ -149,7 +149,7 @@ module Homebrew
condense_requirements(all_deps, args: args) condense_requirements(all_deps, args: args)
all_deps.map! { |d| dep_display_name(d, args: args) } all_deps.map! { |d| dep_display_name(d, args: args) }
all_deps.uniq! all_deps.uniq!
all_deps.sort! unless args.n? all_deps.sort! unless args.topological?
puts all_deps puts all_deps
end end

View File

@ -728,11 +728,11 @@ _brew_deps() {
case "${cur}" in case "${cur}" in
-*) -*)
__brewcomp " __brewcomp "
--1
--all --all
--annotate --annotate
--cask --cask
--debug --debug
--direct
--dot --dot
--for-each --for-each
--formula --formula
@ -746,10 +746,10 @@ _brew_deps() {
--installed --installed
--quiet --quiet
--skip-recommended --skip-recommended
--topological
--tree --tree
--union --union
--verbose --verbose
-n
" "
return return
;; ;;

View File

@ -565,11 +565,11 @@ __fish_brew_complete_arg 'create' -l verbose -d 'Make some output more verbose'
__fish_brew_complete_cmd 'deps' 'Show dependencies for formula' __fish_brew_complete_cmd 'deps' 'Show dependencies for formula'
__fish_brew_complete_arg 'deps' -l 1 -d 'Only show dependencies one level down, instead of recursing'
__fish_brew_complete_arg 'deps' -l all -d 'List dependencies for all available formulae' __fish_brew_complete_arg 'deps' -l all -d 'List dependencies for all available formulae'
__fish_brew_complete_arg 'deps' -l annotate -d 'Mark any build, test, optional, or recommended dependencies as such in the output' __fish_brew_complete_arg 'deps' -l annotate -d 'Mark any build, test, optional, or recommended dependencies as such in the output'
__fish_brew_complete_arg 'deps' -l cask -d 'Treat all named arguments as casks' __fish_brew_complete_arg 'deps' -l cask -d 'Treat all named arguments as casks'
__fish_brew_complete_arg 'deps' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'deps' -l debug -d 'Display any debugging information'
__fish_brew_complete_arg 'deps' -l direct -d 'Show only the direct dependencies declared in the formula'
__fish_brew_complete_arg 'deps' -l dot -d 'Show text-based graph description in DOT format' __fish_brew_complete_arg 'deps' -l dot -d 'Show text-based graph description in DOT format'
__fish_brew_complete_arg 'deps' -l for-each -d 'Switch into the mode used by the `--all` option, but only list dependencies for each provided formula, one formula per line. This is used for debugging the `--installed`/`--all` display mode' __fish_brew_complete_arg 'deps' -l for-each -d 'Switch into the mode used by the `--all` option, but only list dependencies for each provided formula, one formula per line. This is used for debugging the `--installed`/`--all` display mode'
__fish_brew_complete_arg 'deps' -l formula -d 'Treat all named arguments as formulae' __fish_brew_complete_arg 'deps' -l formula -d 'Treat all named arguments as formulae'
@ -583,10 +583,10 @@ __fish_brew_complete_arg 'deps' -l include-test -d 'Include `:test` dependencies
__fish_brew_complete_arg 'deps' -l installed -d 'List dependencies for formulae that are currently installed. If formula is specified, list only its dependencies that are currently installed' __fish_brew_complete_arg 'deps' -l installed -d 'List dependencies for formulae that are currently installed. If formula is specified, list only its dependencies that are currently installed'
__fish_brew_complete_arg 'deps' -l quiet -d 'Make some output more quiet' __fish_brew_complete_arg 'deps' -l quiet -d 'Make some output more quiet'
__fish_brew_complete_arg 'deps' -l skip-recommended -d 'Skip `:recommended` dependencies for formula' __fish_brew_complete_arg 'deps' -l skip-recommended -d 'Skip `:recommended` dependencies for formula'
__fish_brew_complete_arg 'deps' -l topological -d 'Sort dependencies in topological order'
__fish_brew_complete_arg 'deps' -l tree -d 'Show dependencies as a tree. When given multiple formula arguments, show individual trees for each formula' __fish_brew_complete_arg 'deps' -l tree -d 'Show dependencies as a tree. When given multiple formula arguments, show individual trees for each formula'
__fish_brew_complete_arg 'deps' -l union -d 'Show the union of dependencies for multiple formula, instead of the intersection' __fish_brew_complete_arg 'deps' -l union -d 'Show the union of dependencies for multiple formula, instead of the intersection'
__fish_brew_complete_arg 'deps' -l verbose -d 'Make some output more verbose' __fish_brew_complete_arg 'deps' -l verbose -d 'Make some output more verbose'
__fish_brew_complete_arg 'deps' -l n -d 'Sort dependencies in topological order'
__fish_brew_complete_arg 'deps; and not __fish_seen_argument -l cask -l casks' -a '(__fish_brew_suggest_formulae_all)' __fish_brew_complete_arg 'deps; and not __fish_seen_argument -l cask -l casks' -a '(__fish_brew_suggest_formulae_all)'
__fish_brew_complete_arg 'deps; and not __fish_seen_argument -l formula -l formulae' -a '(__fish_brew_suggest_casks_all)' __fish_brew_complete_arg 'deps; and not __fish_seen_argument -l formula -l formulae' -a '(__fish_brew_suggest_casks_all)'

View File

@ -695,10 +695,10 @@ _brew_create() {
# brew deps # brew deps
_brew_deps() { _brew_deps() {
_arguments \ _arguments \
'--1[Only show dependencies one level down, instead of recursing]' \
'(--installed)--all[List dependencies for all available formulae]' \ '(--installed)--all[List dependencies for all available formulae]' \
'--annotate[Mark any build, test, optional, or recommended dependencies as such in the output]' \ '--annotate[Mark any build, test, optional, or recommended dependencies as such in the output]' \
'--debug[Display any debugging information]' \ '--debug[Display any debugging information]' \
'--direct[Show only the direct dependencies declared in the formula]' \
'--dot[Show text-based graph description in DOT format]' \ '--dot[Show text-based graph description in DOT format]' \
'--for-each[Switch into the mode used by the `--all` option, but only list dependencies for each provided formula, one formula per line. This is used for debugging the `--installed`/`--all` display mode]' \ '--for-each[Switch into the mode used by the `--all` option, but only list dependencies for each provided formula, one formula per line. This is used for debugging the `--installed`/`--all` display mode]' \
'--full-name[List dependencies by their full name]' \ '--full-name[List dependencies by their full name]' \
@ -711,10 +711,10 @@ _brew_deps() {
'(--all)--installed[List dependencies for formulae that are currently installed. If formula is specified, list only its dependencies that are currently installed]' \ '(--all)--installed[List dependencies for formulae that are currently installed. If formula is specified, list only its dependencies that are currently installed]' \
'--quiet[Make some output more quiet]' \ '--quiet[Make some output more quiet]' \
'--skip-recommended[Skip `:recommended` dependencies for formula]' \ '--skip-recommended[Skip `:recommended` dependencies for formula]' \
'--topological[Sort dependencies in topological order]' \
'(--graph)--tree[Show dependencies as a tree. When given multiple formula arguments, show individual trees for each formula]' \ '(--graph)--tree[Show dependencies as a tree. When given multiple formula arguments, show individual trees for each formula]' \
'--union[Show the union of dependencies for multiple formula, instead of the intersection]' \ '--union[Show the union of dependencies for multiple formula, instead of the intersection]' \
'--verbose[Make some output more verbose]' \ '--verbose[Make some output more verbose]' \
'-n[Sort dependencies in topological order]' \
- formula \ - formula \
'(--cask)--formula[Treat all named arguments as formulae]' \ '(--cask)--formula[Treat all named arguments as formulae]' \
'*::formula:__brew_formulae' \ '*::formula:__brew_formulae' \

View File

@ -140,10 +140,10 @@ Show dependencies for *`formula`*. Additional options specific to *`formula`*
may be appended to the command. When given multiple formula arguments, may be appended to the command. When given multiple formula arguments,
show the intersection of dependencies for each formula. show the intersection of dependencies for each formula.
* `-n`: * `-n`, `--topological`:
Sort dependencies in topological order. Sort dependencies in topological order.
* `--1`: * `-1`, `--direct`:
Only show dependencies one level down, instead of recursing. Show only the direct dependencies declared in the formula.
* `--union`: * `--union`:
Show the union of dependencies for multiple *`formula`*, instead of the intersection. Show the union of dependencies for multiple *`formula`*, instead of the intersection.
* `--full-name`: * `--full-name`:

View File

@ -154,12 +154,12 @@ Show Homebrew and system configuration info useful for debugging\. If you file a
Show dependencies for \fIformula\fR\. Additional options specific to \fIformula\fR may be appended to the command\. When given multiple formula arguments, show the intersection of dependencies for each formula\. Show dependencies for \fIformula\fR\. Additional options specific to \fIformula\fR may be appended to the command\. When given multiple formula arguments, show the intersection of dependencies for each formula\.
. .
.TP .TP
\fB\-n\fR \fB\-n\fR, \fB\-\-topological\fR
Sort dependencies in topological order\. Sort dependencies in topological order\.
. .
.TP .TP
\fB\-\-1\fR \fB\-1\fR, \fB\-\-direct\fR
Only show dependencies one level down, instead of recursing\. Show only the direct dependencies declared in the formula\.
. .
.TP .TP
\fB\-\-union\fR \fB\-\-union\fR