Prevent warning and errors from breaking the sync
This commit is contained in:
@@ -2,13 +2,14 @@
|
||||
|
||||
require "formula"
|
||||
require "json"
|
||||
require "readall"
|
||||
|
||||
module Homebrew
|
||||
module Cmd
|
||||
class BrewerTapContentInfo < AbstractCommand
|
||||
cmd_args do
|
||||
description <<~EOS
|
||||
Do something. Place a description here.
|
||||
Display the information about third-party casks and formulas.
|
||||
EOS
|
||||
flag "--json",
|
||||
description: "Print a JSON representation. Currently the default value for <version> is `v1` for " \
|
||||
@@ -19,16 +20,19 @@ module Homebrew
|
||||
switch "--cask", "--casks",
|
||||
description: "Treat all named arguments as casks."
|
||||
conflicts "--formula", "--cask"
|
||||
|
||||
named_args [:tap]
|
||||
end
|
||||
|
||||
def run
|
||||
begin
|
||||
original_stderr = $stderr.clone
|
||||
$stderr.reopen(File.new("/dev/null", "w"))
|
||||
|
||||
formulae = []
|
||||
casks = []
|
||||
|
||||
Tap.each do |tap|
|
||||
next if ["homebrew/core", "homebrew/cask"].include?(tap.name)
|
||||
next unless valid_tap? tap
|
||||
|
||||
unless args.cask?
|
||||
tap.formula_files.each do |formula_file|
|
||||
@@ -49,6 +53,19 @@ module Homebrew
|
||||
}
|
||||
|
||||
puts JSON.pretty_generate(json)
|
||||
ensure
|
||||
$stderr.reopen(original_stderr)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def valid_tap?(tap)
|
||||
begin
|
||||
Readall.valid_tap?(tap, aliases: true)
|
||||
rescue Interrupt, RuntimeError
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user