Module: YARD::CLI::LinkStdlib::CommandHelper
Overview
Definitions
Instance Method Summary collapse
- #add_header(op, text = nil) ⇒ Object
- #add_version_opt(op) ⇒ Object
- #check_args!(args, count) ⇒ Object
- #description ⇒ Object
- #opts ⇒ Object
- #usage ⇒ Object
Instance Method Details
#add_header(op, text = nil) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/yard/cli/link_stdlib/command_helper.rb', line 59 def add_header op, text = nil op. = 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 ( op ) end |
#add_version_opt(op) ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# 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) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# 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 ⇒ Object
31 32 33 |
# File 'lib/yard/cli/link_stdlib/command_helper.rb', line 31 def description self.class::DESCRIPTION end |
#opts ⇒ Object
54 55 56 |
# File 'lib/yard/cli/link_stdlib/command_helper.rb', line 54 def opts @opts ||= {} end |
#usage ⇒ Object
36 37 38 |
# File 'lib/yard/cli/link_stdlib/command_helper.rb', line 36 def usage self.class::USAGE end |