Method: Postview::CLI::Command#start

Defined in:
lib/postview/cli.rb

#start(process, &block) ⇒ Object



55
56
57
58
59
60
61
62
63
64
# File 'lib/postview/cli.rb', line 55

def start process, &block
  printf "%1$s %2$s ", ">"*2, process
  if block_given?
    result = yield
    printf " %s\n", (result ? "done" : "fail")
  end
rescue Exception => error
  printf " error\n"
  abort format("%1$s %2$s \n", ">"*2, error)
end