Sha256: 3abd4e5a19837526c47a0d24386a5a8241587babc6a038301964e901824e299b

Contents?: true

Size: 1022 Bytes

Versions: 4

Compression:

Stored size: 1022 Bytes

Contents

require "vmc/cli/app/base"

module VMC::App
  class Crashes < Base
    desc "List an app's crashed instances"
    group :apps, :info, :hidden => true
    input :apps, :argument => :splat, :singular => :app,
      :desc => "Applications whose crashed instances to list",
      :from_given => by_name("app")
    def crashes
      apps = input[:apps]
      fail "No applications given." if apps.empty?

      spaced(apps) do |app|
        instances =
          with_progress("Getting crashed instances for #{c(app.name, :name)}") do
            app.crashes
          end

        spaced(instances) do |i|
          if quiet?
            line i.id
          else
            display_crashed_instance(i)
          end
        end
      end
    end

    def display_crashed_instance(i)
      start_line "instance #{c("\##{i.id}", :instance)}: "
      puts "#{b(c("crashed", :error))} "

      indented do
        if s = i.since
          line "since: #{c(s.strftime("%F %r"), :neutral)}"
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vmc-0.4.0 lib/vmc/cli/app/crashes.rb
vmc-0.4.0.beta.97 vmc-ng/lib/vmc/cli/app/crashes.rb
vmc-0.4.0.beta.96 vmc-ng/lib/vmc/cli/app/crashes.rb
vmc-0.4.0.beta.94 vmc-ng/lib/vmc/cli/app/crashes.rb