Class: Cask::Cmd::Help Private
- Inherits:
-
AbstractCommand
- Object
- AbstractCommand
- Cask::Cmd::Help
- Defined in:
- Library/Homebrew/cask/cmd/help.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Implementation of the brew cask help
command.
Constant Summary
Constants inherited from AbstractCommand
Instance Attribute Summary
Attributes inherited from AbstractCommand
Class Method Summary collapse
- .commands ⇒ Object private
- .description ⇒ Object private
- .max_named ⇒ Object private
Instance Method Summary collapse
- #run ⇒ Object private
Methods inherited from AbstractCommand
abstract?, banner_args, banner_headline, command_name, help, #initialize, min_named, parser, run, short_description, visible?
Methods included from Homebrew::Search
#query_regexp, #search_casks, #search_descriptions, #search_formulae, #search_taps
Constructor Details
This class inherits a constructor from Cask::Cmd::AbstractCommand
Class Method Details
.commands ⇒ 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.
32 33 34 |
# File 'Library/Homebrew/cask/cmd/help.rb', line 32 def self.commands Cmd.command_classes.select(&:visible?).map { |klass| [klass.command_name, klass] }.to_h end |
.description ⇒ 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.
14 15 16 |
# File 'Library/Homebrew/cask/cmd/help.rb', line 14 def self.description "Print help for `cask` commands." end |
.max_named ⇒ 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.
10 11 12 |
# File 'Library/Homebrew/cask/cmd/help.rb', line 10 def self.max_named 1 end |
Instance Method Details
#run ⇒ 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.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'Library/Homebrew/cask/cmd/help.rb', line 18 def run if args.named.empty? puts Cmd.parser.generate_help_text else command_name = args.named.first unless command = self.class.commands[command_name] raise "No help information found for command '#{command_name}'." end puts command.help end end |