Class: Uh::WM::CLI

Inherits:
Baf::CLI
  • Object
show all
Defined in:
lib/uh/wm/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.handle_error(env, ex) ⇒ Object



5
6
7
8
# File 'lib/uh/wm/cli.rb', line 5

def handle_error env, ex
  env.puts_error "#{ex.class.name}: #{ex.message}"
  env.puts_error ex.backtrace.map { |l| '  %s' % l } if env.debug?
end

Instance Method Details

#runObject



33
34
35
36
# File 'lib/uh/wm/cli.rb', line 33

def run
  env.log_logger_level
  Runner.run env
end

#setupObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/uh/wm/cli.rb', line 11

def setup
  flag_verbose
  flag_debug
  flag_version WM::VERSION

  option :f, :run_control, 'PATH', 'specify alternate run control file' do |path|
    @env.rc_path = path
  end
  option :r, :require, 'PATH', 'require ruby feature' do |feature|
    require feature
    env.log "Loaded `#{feature}' ruby feature"
  end
  option :l, :layout, 'LAYOUT', 'specify layout' do |layout|
    env.layout_class = Object.const_get layout.to_sym
  end
  option :w, :worker, 'WORKER', 'specify worker' do |worker|
    env.worker = worker.to_sym
  end

  env.sync_output
end