lib/travis/cli/whatsup.rb in travis-1.7.7.travis.681.5 vs lib/travis/cli/whatsup.rb in travis-1.7.7.travis.683.5
- old
+ new
@@ -5,10 +5,12 @@
class Whatsup < ApiCommand
description "lists most recent builds"
on('-m', '--my-repos', 'Only display my own repositories')
def run
+ say "nothing to show" if recent.empty?
+
recent.each do |repo|
say [
color(repo.slug, [:bold, repo.color]),
color("#{repo.last_build.state}: ##{repo.last_build.number}", repo.color)
].join(" ")
@@ -16,11 +18,13 @@
end
private
def recent
- return repos unless my_repos
- repos(:member => user.login)
+ @recent ||= begin
+ recent = my_repos ? repos : repos(:member => user.login)
+ recent.select { |repo| repo.last_build }
+ end
end
end
end
end