Class: Kubetailrb::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/kubetailrb/cli.rb

Overview

CLI application to run kubetailrb.

Instance Method Summary collapse

Instance Method Details

#execute(*args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/kubetailrb/cli.rb', line 8

def execute(*args)
  cmd = OptsParser.new(*args).parse

  # NOTE: Is it better to use this approach by checking the method existence
  # or is it better to use a raise/rescue approach? Or another approach?
  raise 'Invalid cmd' unless cmd.respond_to?(:execute)

  begin
    cmd.execute
  # Capture Ctrl+c so the program will not display an error in the
  # terminal.
  rescue SignalException
    puts '' # No need to display anything.
  end
end