Sha256: 29851da9d5a8936ced898706385d071fe4eac4afa84da81c5e2f1223785f7c15

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

require 'eac_launcher/context'
require 'avm/launcher/instances/runner_helper'

module Avm
  module Tools
    class Runner
      class Launcher
        class Projects < ::Avm::Launcher::Instances::RunnerHelper
          runner_with :help do
            desc 'Shows available projects.'
            bool_opt '--recache', 'Rewrite instances cache.'
            bool_opt '-i', '--instances', 'Show instances.'
          end

          def run
            ::EacLauncher::Context.current.recache = parsed.recache?
            ::EacLauncher::Context.current.projects.each do |p|
              show_project(p)
            end
          end

          private

          def show_project(project)
            puts project_label(project)
            return unless parsed.instances?

            project.instances.each do |i|
              puts "  * #{instance_label(i)}"
            end
          end

          def project_label(project)
            project.to_s.cyan.to_s
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
avm-tools-0.99.0 lib/avm/tools/runner/launcher/projects.rb
avm-tools-0.98.0 lib/avm/tools/runner/launcher/projects.rb
avm-tools-0.97.0 lib/avm/tools/runner/launcher/projects.rb
avm-tools-0.96.0 lib/avm/tools/runner/launcher/projects.rb