Class: YARD::CLI::LinkStdlib::URL

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

Overview

Definitions

Constant Summary collapse

DESCRIPTION =
"Print the online doc URL for a stdlib name"
USAGE =
"yard stdlib url [OPTIONS] NAME"

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
# File 'lib/yard/cli/link_stdlib/url.rb', line 39

def run *args
  OptionParser.new { |op|
    add_header op
    add_version_opt op
  }.parse! args
  
  name = check_args! args, 1
  
  url = YARD::LinkStdlib::ObjectMap.current.url_for name
  
  if url.nil?
    $stderr.puts "Name not found: #{ name.inspect }"
    exit false
  end
  
  puts url
  exit true
end