Module: Codebot::Options
- Defined in:
- lib/codebot/options.rb,
lib/codebot/options/base.rb,
lib/codebot/options/core.rb,
lib/codebot/options/network.rb,
lib/codebot/options/integration.rb
Overview
This module provides functionality for parsing command-line options.
Defined Under Namespace
Classes: Base, Core, Integration, Network
Class Method Summary collapse
-
.with_core(opts, rehash = false) {|Core| ... } ⇒ Object
Creates a new Core from the specified command-line options.
-
.with_errors ⇒ Object
Invokes the given block, handling UserError errors.
-
.with_ipc_client(opts) {|IPCClient| ... } ⇒ Object
Creates a new IPCClient from the specified command-line options.
Class Method Details
.with_core(opts, rehash = false) {|Core| ... } ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/codebot/options.rb', line 17 def self.with_core(opts, rehash = false) core = ::Codebot::Core.new( config_file: opts[:config], ipc_pipe: opts[:pipe] ) with_errors { yield core } return unless rehash with_ipc_client(opts) do |ipc| break unless ipc.send_rehash(!opts[:pipe].nil?) puts 'Rehashing the running instance...' unless opts[:quiet] end end |
.with_errors ⇒ Object
Invokes the given block, handling UserError errors.
33 34 35 36 37 38 |
# File 'lib/codebot/options.rb', line 33 def self.with_errors yield rescue UserError => e STDERR.puts "Error: #{e.}" exit 1 end |