Class: WifiWand::Commands::Help

Inherits:
Base
  • Object
show all
Defined in:
lib/wifi_wand/commands/help.rb

Constant Summary

Constants inherited from Base

Base::DEFAULT_INVOCATION_OPTIONS

Instance Attribute Summary

Attributes inherited from Base

#cli, #metadata

Instance Method Summary collapse

Methods inherited from Base

#aliases, allow_invocation_options, allowed_invocation_options, #bind, binding_sources, binds, command_metadata, declared_metadata, #initialize, #validate_options

Constructor Details

This class inherits a constructor from WifiWand::Commands::Base

Instance Method Details

#call(*args) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/wifi_wand/commands/help.rb', line 24

def call(*args)
  validate_max_arguments!(args, 1)

  command_name = args.first
  command = help_command_for(command_name)

  if command&.help_text
    output.puts(command.help_text)
  else
    cli.print_help
  end
end

#help_textObject



18
19
20
21
22
# File 'lib/wifi_wand/commands/help.rb', line 18

def help_text
  return .usage unless cli

  cli.help_text
end