Class: Gerrit::Command::List
Overview
Show a list of changes matching a specified query.
Instance Method Summary collapse
Methods inherited from Base
Methods included from Utils
camel_case, commit_hash?, human_time, map_in_parallel, snake_case
Constructor Details
This class inherits a constructor from Gerrit::Command::Base
Instance Method Details
#execute ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/gerrit/command/list.rb', line 4 def execute # Get changes ordered from newest to oldest changes = ui.spinner('Loading ') do client.query_changes(query).sort_by { |change| -change['lastUpdated'] } end # Display changes in reverse order so that the newest are at the bottom of # the table (i.e. the part that will be visible in a console when there is # a long list) ui.table(header: %w[# CR V Subject Owner Project Updated], alignments: [:left, :center, :center, :left, :left, :left, :right], padding: [0,1,0,1]) do |t| changes.each_with_index.map do |change, index| [ index + 1, symbol_for_status('Code-Review', change), symbol_for_status('Verified', change), change['subject'], change['owner']['name'], change['project'], human_time(Time.at(change['lastUpdated'])), ] end.reverse.each do |row| t << row end end end |