Class: YARD::CLI::Base Abstract
- Inherits:
-
Object
- Object
- YARD::CLI::Base
- Defined in:
- lib/yard/cli/base.rb
Overview
This class is abstract.
Abstract base class for CLI utilities. Provides some helper methods for the option parser
Instance Method Summary
- - (void) common_options(opts) Adds a set of common options to the tail of the OptionParser.
- - (Base) initialize constructor A new instance of Base.
Constructor Details
- (Base) initialize
A new instance of Base
10 11 12 |
# File 'lib/yard/cli/base.rb', line 10 def initialize log.show_backtraces = false end |
Instance Method Details
- (void) common_options(opts)
This method returns an undefined value.
Adds a set of common options to the tail of the OptionParser
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/yard/cli/base.rb', line 18 def (opts) opts.separator "" opts.separator "Other options:" opts.on_tail('-q', '--quiet', 'Show no warnings.') { log.level = Logger::ERROR } opts.on_tail('--verbose', 'Show more information.') { log.level = Logger::INFO } opts.on_tail('--debug', 'Show debugging information.') { log.level = Logger::DEBUG } opts.on_tail('--backtrace', 'Show stack traces') { log.show_backtraces = true } opts.on_tail('-v', '--version', 'Show version.') { puts "yard #{YARD::VERSION}"; exit } opts.on_tail('-h', '--help', 'Show this help.') { puts opts; exit } end |