Class: OsCtl::Cli::Top::Main

Inherits:
Command
  • Object
show all
Defined in:
lib/osctl/cli/top/main.rb

Instance Method Summary collapse

Methods inherited from Command

#cli_opt, #format_output, #osctld_call, #osctld_fmt, #osctld_open, #osctld_resp, run

Instance Method Details

#startObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/osctl/cli/top/main.rb', line 5

def start
  model = Top::Model.new(enable_iostat: opts[:iostat])
  model.setup

  kwargs = {}

  if gopts[:json]
    klass = Top::JsonExporter

  else
    klass = Top::Tui
    kwargs = { enable_procs: opts[:processes] }
  end

  view = klass.new(model, opts[:rate], **kwargs)
  view.start
end