Class: YARD::CLI::LinkStdlib::Help

Inherits:
Command
  • Object
show all
Includes:
CommandHelper
Defined in:
lib/yard/cli/link_stdlib/help.rb

Overview

Definitions

Constant Summary collapse

USAGE =
"yard stdlib help [OTHER_OPTIONS]"
DESCRIPTION =
"Show this message"

Instance Method Summary collapse

Methods included from CommandHelper

#add_header, #add_version_opt, #check_args!, #description, #opts, #usage

Instance Method Details

#run(*args) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/yard/cli/link_stdlib/help.rb', line 39

def run *args
  OptionParser.new { |op|
    add_header op
  }.parse! args
  
  commands = LinkStdlib.commands
  log.puts <<~END
    yard-link_stdlib provides linking to online Ruby docs for standard 
    library code objects.
    
    Usage:
    
        yard stdlib COMMAND... [OPTIONS] [ARGS]
    
    Commands:
    
  END
  commands.keys.sort_by(&:to_s).each do |command_name|
    command_class = commands[command_name]
    next unless command_class < Command
    command = command_class.new
    log.puts "%-8s %s" % [command_name, command.description]
  end
  log.puts
end