Class: Homebrew::DevCmd::Cat Private
- Inherits:
-
AbstractCommand
- Object
- AbstractCommand
- Homebrew::DevCmd::Cat
- Includes:
- FileUtils
- Defined in:
- dev-cmd/cat.rb,
sorbet/rbi/dsl/homebrew/dev_cmd/cat.rbi
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Defined Under Namespace
Classes: Args
Instance Method Summary collapse
- #args ⇒ Homebrew::DevCmd::Cat::Args private
- #run ⇒ void private
Methods inherited from AbstractCommand
command, command_name, dev_cmd?, #initialize, parser, ruby_cmd?
Constructor Details
This class inherits a constructor from Homebrew::AbstractCommand
Instance Method Details
#args ⇒ Homebrew::DevCmd::Cat::Args
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
10 |
# File 'sorbet/rbi/dsl/homebrew/dev_cmd/cat.rbi', line 10 def args; end |
#run ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'dev-cmd/cat.rb', line 28 def run cd HOMEBREW_REPOSITORY do pager = if Homebrew::EnvConfig.bat? ENV["BAT_CONFIG_PATH"] = Homebrew::EnvConfig.bat_config_path ENV["BAT_THEME"] = Homebrew::EnvConfig.bat_theme ensure_formula_installed!( "bat", reason: "displaying <formula>/<cask> source", # The user might want to capture the output of `brew cat ...` # Redirect stdout to stderr output_to_stderr: true, ).opt_bin/"bat" else "cat" end args.named.to_paths.each do |path| next path if path.exist? path = path.basename(".rb") if args.cask? ofail "#{path}'s source doesn't exist on disk." end if Homebrew.failed? $stderr.puts "The name may be wrong, or the tap hasn't been tapped. Instead try:" treat_as = "--cask " if args.cask? treat_as = "--formula " if args.formula? $stderr.puts " brew info --github #{treat_as}#{args.named.join(" ")}" return end safe_system pager, *args.named.to_paths end end |