Module: Homebrew::Help Private
- Defined in:
- Library/Homebrew/help.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Helper module for printing help output.
Class Method Summary collapse
Class Method Details
.help(cmd = nil, empty_argv: false, usage_error: nil, remaining_args: []) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'Library/Homebrew/help.rb', line 46 def 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 exit 1 end # Handle `brew (-h|--help|--usage|-?|help)` (no other arguments). puts HOMEBREW_HELP 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: remaining_args) : HOMEBREW_HELP $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: remaining_args) exit 0 end |