Sha256: 590b0987629e79055a458dfb31e4f469315b31732b4bdb3ba026ef9ca330516d

Contents?: true

Size: 725 Bytes

Versions: 6

Compression:

Stored size: 725 Bytes

Contents

# frozen_string_literal: true

require 'travis/cli'

module Travis
  module CLI
    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(' ')
        end
      end

      private

      def recent
        @recent ||= begin
          recent = my_repos ? repos : repos(member: user.login)
          recent.select { |repo| repo.last_build }
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
travis-1.14.0 lib/travis/cli/whatsup.rb
travis-1.13.3 lib/travis/cli/whatsup.rb
travis-1.13.2 lib/travis/cli/whatsup.rb
travis-1.13.1 lib/travis/cli/whatsup.rb
travis-1.13.0 lib/travis/cli/whatsup.rb
travis-1.12.0 lib/travis/cli/whatsup.rb