Class: Cask::Cmd::InternalHelp

Inherits:
AbstractInternalCommand show all
Defined in:
brew/Library/Homebrew/cask/cmd/internal_help.rb

Instance Attribute Summary

Attributes inherited from AbstractCommand

#args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractInternalCommand

command_name, visible

Methods inherited from AbstractCommand

abstract?, command_name, run, visible

Methods included from Homebrew::Search

#query_regexp, #search_casks, #search_descriptions, #search_formulae, #search_taps

Methods included from Options

#process_arguments

Constructor Details

#initializeInternalHelp

Returns a new instance of InternalHelp

Raises:

  • (ArgumentError)


6
7
8
9
10
11
# File 'brew/Library/Homebrew/cask/cmd/internal_help.rb', line 6

def initialize(*)
  super
  return if args.empty?

  raise ArgumentError, "#{self.class.command_name} does not take arguments."
end

Class Method Details

.helpObject



28
29
30
# File 'brew/Library/Homebrew/cask/cmd/internal_help.rb', line 28

def self.help
  "print help strings for unstable internal-use commands"
end

.help_for(klass) ⇒ Object



24
25
26
# File 'brew/Library/Homebrew/cask/cmd/internal_help.rb', line 24

def self.help_for(klass)
  klass.respond_to?(:help) ? klass.help : nil
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
# File 'brew/Library/Homebrew/cask/cmd/internal_help.rb', line 13

def run
  max_command_len = Cmd.commands.map(&:length).max
  puts "Unstable Internal-use Commands:\n\n"
  Cmd.command_classes.each do |klass|
    next if klass.visible

    puts "    #{klass.command_name.ljust(max_command_len)}  #{self.class.help_for(klass)}"
  end
  puts "\n"
end