Class: RuboCop::Daemon::CLI
- Inherits:
-
Object
- Object
- RuboCop::Daemon::CLI
- Defined in:
- lib/rubocop/daemon/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.new_parser(&_block) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/rubocop/daemon/cli.rb', line 8 def self.new_parser(&_block) OptionParser.new do |opts| opts.version = VERSION yield(opts) end end |
Instance Method Details
#parser ⇒ Object
28 29 30 31 32 |
# File 'lib/rubocop/daemon/cli.rb', line 28 def parser @parser ||= self.class.new_parser do |opts| opts. = 'usage: rubocop-daemon <command> [<args>]' end end |
#run(argv = ARGV) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rubocop/daemon/cli.rb', line 15 def run(argv = ARGV) parser.order!(argv) return if argv.empty? create_subcommand_instance(argv) rescue OptionParser::InvalidOption => e warn "error: #{e.}" exit 1 rescue UnknownClientCommandError => e warn "rubocop-daemon: #{e.}. See 'rubocop-daemon --help'." exit 1 end |