Class: Space::Architect::CLI::Architect::Jobs::List

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/space_architect/cli/architect.rb

Instance Method Summary collapse

Methods inherited from BaseCommand

commit_message_options, phase

Instance Method Details

#call(host: nil, token: nil, **opts) ⇒ Object



995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
# File 'lib/space_architect/cli/architect.rb', line 995

def call(host: nil, token: nil, **opts)
  setup_terminal(**opts.slice(:color, :colors))
  handle_errors do
    Jobs.require_credentials!(host, token)
    jobs = JobsClient.new(host, token).list
    if jobs.empty?
      terminal.say "No jobs"
    else
      rows = jobs.map do |j|
        [j["id"], j["status"], j["run_id"], j["created_at"],
         j["harness"], j["model"], j.dig("provenance", "lane")]
      end
      terminal.say terminal.table(%w[ID Status RunID CreatedAt Harness Model Lane], rows)
    end
    CLI.record_outcome(Outcome.new(exit_code: 0))
  end
end