module YARD::CLI::LinkStdlib::CommandHelper
Definitions
¶ ↑
Public Instance Methods
add_header(op, text = nil)
click to toggle source
# File lib/yard/cli/link_stdlib/command_helper.rb, line 59 def add_header op, text = nil op.banner = description op.separator '' op.separator 'Usage:' op.separator '' op.separator " #{ usage }" op.separator '' unless text.nil? text.lines.each { |line| op.separator line } end # Call {YARD::CLI::Command#common_options}, which adds file loading, plugin # loading, logging, YARD version and help options common_options( op ) end
add_version_opt(op)
click to toggle source
# File lib/yard/cli/link_stdlib/command_helper.rb, line 75 def add_version_opt op # **DON'T** make missing versions by default here! YARD::LinkStdlib::RubySource.make_missing = false op.on( '-R VERSION', '--ruby-version=VERSION', %(Set Ruby version) ) { |ruby_version| YARD::LinkStdlib::RubyVersion.set ruby_version } op.on( '--make-missing', %(Download and make an object map if the Ruby version is not present) ) { |make_missing| YARD::LinkStdlib::RubySource.make_missing = make_missing } end
check_args!(args, count)
click to toggle source
# File lib/yard/cli/link_stdlib/command_helper.rb, line 41 def check_args! args, count if args.length < count log.error "Too few args! Expected #{ count }, given #{ args.length }" exit false elsif args.length > count log.error "Too many args! Expected #{ count }, given #{ args.length }" exit false end if args.length == 1 then args[ 0 ] else args end end
description()
click to toggle source
# File lib/yard/cli/link_stdlib/command_helper.rb, line 31 def description self.class::DESCRIPTION end
opts()
click to toggle source
# File lib/yard/cli/link_stdlib/command_helper.rb, line 54 def opts @opts ||= {} end
usage()
click to toggle source
# File lib/yard/cli/link_stdlib/command_helper.rb, line 36 def usage self.class::USAGE end