Class: Pytty::Client::Cli::PsCommand

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/pytty/client/cli/ps_command.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/pytty/client/cli/ps_command.rb', line 13

def execute
  process_yield_jsons = Async.run do
    Pytty::Client::Api::Ps.run
  end.wait

  unless quiet?
    puts "id\trunning\tstatus\tcmd"
    puts "-"*40
  end
  for process_yield_json in process_yield_jsons do
    process_yield = Pytty::Client::ProcessYield.from_json process_yield_json
    if quiet?
      puts process_yield.id
    else
      puts process_yield
    end
  end
end