class YARD::CLI::LinkStdlib

Top-level {YARD::CLI::Command} for the `yard-link_stdlib` plugin. Added under the name `stdlib` (see {YARD::LinkStdlib.install!}).

Simply a router to the sub-commands. Like {YARD::CLI::CommandParser}, which handles routing for `yard`, but is not really re-usable. In addition, this class handles “-” → “_” conversion in sub-command names, since we have multi-word commands.

Public Class Methods

commands() click to toggle source

Singleton Methods

# File lib/yard/cli/link_stdlib.rb, line 57
def self.commands
  @commands
end

Public Instance Methods

description() click to toggle source

Instance Methods

# File lib/yard/cli/link_stdlib.rb, line 65
def description
  "Mange Ruby stdlib linking"
end
run(*args) click to toggle source
# File lib/yard/cli/link_stdlib.rb, line 70
def run *args
  # log.level = Logger::INFO
  
  target = self.class.commands

  args = [ 'help' ] if args.empty?

  while target.is_a? Hash
    key = args[0].gsub( '-', '_' ).to_sym
    if target.key? key
      target = target[key]
      args.shift
    else
      raise "Bad command name: #{ args[0] }"
    end
  end

  target.run( *args )
end