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
|
||||
"cat"
|
||||
end
|
||||
safe_system pager, args.formulae.first.path, *args.passthrough
|
||||
safe_system pager, args.formulae_paths.first, *args.passthrough
|
||||
end
|
||||
end
|
||||
|
@ -45,7 +45,7 @@ module Homebrew
|
||||
elsif args.named.any? { |tap| tap.count("/") == 1 }
|
||||
args.named.map { |tap| Tap.fetch(tap).path }
|
||||
else
|
||||
args.formulae.map(&:path)
|
||||
args.formulae_paths
|
||||
end
|
||||
|
||||
only_cops = args.only_cops
|
||||
|
@ -84,7 +84,7 @@ module Homebrew
|
||||
files = Tap.map(&:formula_dir)
|
||||
else
|
||||
ff = args.resolved_formulae
|
||||
files = args.resolved_formulae.map(&:path)
|
||||
files = args.formulae_paths
|
||||
end
|
||||
|
||||
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
|
||||
Homebrew repository for editing if no formula is provided.
|
||||
EOS
|
||||
switch :force
|
||||
switch :verbose
|
||||
switch :debug
|
||||
end
|
||||
@ -31,16 +30,10 @@ module Homebrew
|
||||
EOS
|
||||
end
|
||||
|
||||
paths = args.formulae_paths.presence
|
||||
|
||||
# If no brews are listed, open the project root in an editor.
|
||||
paths = [HOMEBREW_REPOSITORY] if args.no_named?
|
||||
|
||||
# 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
|
||||
paths ||= [HOMEBREW_REPOSITORY]
|
||||
|
||||
exec_editor(*paths)
|
||||
end
|
||||
|
@ -22,6 +22,6 @@ module Homebrew
|
||||
def formula
|
||||
formula_args.parse
|
||||
|
||||
args.resolved_formulae.each { |f| puts f.path }
|
||||
args.formulae_paths.each(&method(:puts))
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user