Module: Homebrew::Help Private
- Extended by:
- Utils::Output::Mixin
- Defined in:
- help.rb
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Helper module for printing help output.
Class Method Summary collapse
Methods included from Utils::Output::Mixin
odebug, odeprecated, odie, odisabled, ofail, oh1, oh1_title, ohai, ohai_title, onoe, opoo, opoo_outside_github_actions, pretty_duration, pretty_installed, pretty_outdated, pretty_uninstalled
Class Method Details
.help(cmd = nil, empty_argv: false, usage_error: nil, remaining_args: []) ⇒ 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.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'help.rb', line 21 def self.help(cmd = nil, empty_argv: false, usage_error: nil, remaining_args: []) if cmd.nil? # Handle `brew` (no arguments). if empty_argv $stderr.puts HOMEBREW_HELP_MESSAGE exit 1 end # Handle `brew (-h|--help|--usage|-?|help)` (no other arguments). puts HOMEBREW_HELP_MESSAGE exit 0 end # Resolve command aliases and find file containing the implementation. path = Commands.path(cmd) # Display command-specific (or generic) help in response to `UsageError`. if usage_error $stderr.puts path ? command_help(cmd, path, remaining_args:) : HOMEBREW_HELP_MESSAGE $stderr.puts onoe usage_error exit 1 end # Resume execution in `brew.rb` for unknown commands. return if path.nil? # Display help for internal command (or generic help if undocumented). puts command_help(cmd, path, remaining_args:) exit 0 end |