mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
cmd, dev-cmd: use args.formulae_paths.
This makes these commands robust to invalid syntax.
This commit is contained in:
parent
5366da76fd
commit
4fb649cad1
@ -25,6 +25,6 @@ module Homebrew
|
|||||||
else
|
else
|
||||||
"cat"
|
"cat"
|
||||||
end
|
end
|
||||||
safe_system pager, args.formulae.first.path, *args.passthrough
|
safe_system pager, args.formulae_paths.first, *args.passthrough
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -45,7 +45,7 @@ module Homebrew
|
|||||||
elsif args.named.any? { |tap| tap.count("/") == 1 }
|
elsif args.named.any? { |tap| tap.count("/") == 1 }
|
||||||
args.named.map { |tap| Tap.fetch(tap).path }
|
args.named.map { |tap| Tap.fetch(tap).path }
|
||||||
else
|
else
|
||||||
args.formulae.map(&:path)
|
args.formulae_paths
|
||||||
end
|
end
|
||||||
|
|
||||||
only_cops = args.only_cops
|
only_cops = args.only_cops
|
||||||
|
@ -84,7 +84,7 @@ module Homebrew
|
|||||||
files = Tap.map(&:formula_dir)
|
files = Tap.map(&:formula_dir)
|
||||||
else
|
else
|
||||||
ff = args.resolved_formulae
|
ff = args.resolved_formulae
|
||||||
files = args.resolved_formulae.map(&:path)
|
files = args.formulae_paths
|
||||||
end
|
end
|
||||||
|
|
||||||
only_cops = args.only_cops
|
only_cops = args.only_cops
|
||||||
|
@ -14,7 +14,6 @@ module Homebrew
|
|||||||
Open <formula> in the editor set by `EDITOR` or `HOMEBREW_EDITOR`, or open the
|
Open <formula> in the editor set by `EDITOR` or `HOMEBREW_EDITOR`, or open the
|
||||||
Homebrew repository for editing if no formula is provided.
|
Homebrew repository for editing if no formula is provided.
|
||||||
EOS
|
EOS
|
||||||
switch :force
|
|
||||||
switch :verbose
|
switch :verbose
|
||||||
switch :debug
|
switch :debug
|
||||||
end
|
end
|
||||||
@ -31,16 +30,10 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
paths = args.formulae_paths.presence
|
||||||
|
|
||||||
# If no brews are listed, open the project root in an editor.
|
# If no brews are listed, open the project root in an editor.
|
||||||
paths = [HOMEBREW_REPOSITORY] if args.no_named?
|
paths ||= [HOMEBREW_REPOSITORY]
|
||||||
|
|
||||||
# Don't use args.formulae as that will throw if the file doesn't parse
|
|
||||||
paths ||= args.named.map do |name|
|
|
||||||
path = Formulary.path(name)
|
|
||||||
raise FormulaUnavailableError, name if !path.file? && !args.force?
|
|
||||||
|
|
||||||
path
|
|
||||||
end
|
|
||||||
|
|
||||||
exec_editor(*paths)
|
exec_editor(*paths)
|
||||||
end
|
end
|
||||||
|
@ -22,6 +22,6 @@ module Homebrew
|
|||||||
def formula
|
def formula
|
||||||
formula_args.parse
|
formula_args.parse
|
||||||
|
|
||||||
args.resolved_formulae.each { |f| puts f.path }
|
args.formulae_paths.each(&method(:puts))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user