Sha256: 569e698cc6ad31d22faa241a947dee3b1a049e68610d15183f88495b4a4cac8b

Contents?: true

Size: 810 Bytes

Versions: 12

Compression:

Stored size: 810 Bytes

Contents

# frozen_string_literal: true

require "project_types/theme/presenters/themes_presenter"

module Theme
  module Forms
    class Select < ShopifyCLI::Form
      attr_accessor :theme
      flag_arguments :root, :title, :exclude_roles, :include_foreign_developments

      def ask
        self.theme = CLI::UI::Prompt.ask(title, allow_empty: false) do |handler|
          theme_presenters.each do |presenter|
            theme = presenter.theme

            next if exclude_roles&.include?(theme.role)
            next if !include_foreign_developments && theme.foreign_development?

            handler.option(presenter.to_s(:short)) { theme }
          end
        end
      end

      private

      def theme_presenters
        Theme::Presenters::ThemesPresenter.new(ctx, root).all
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
shopify-cli-2.17.0 lib/project_types/theme/forms/select.rb
shopify-cli-2.16.1 lib/project_types/theme/forms/select.rb
shopify-cli-2.16.0 lib/project_types/theme/forms/select.rb
shopify-cli-2.15.6 lib/project_types/theme/forms/select.rb
shopify-cli-2.15.5 lib/project_types/theme/forms/select.rb
shopify-cli-2.15.4 lib/project_types/theme/forms/select.rb
shopify-cli-2.15.3 lib/project_types/theme/forms/select.rb
shopify-cli-2.15.2 lib/project_types/theme/forms/select.rb
shopify-cli-2.15.1 lib/project_types/theme/forms/select.rb
shopify-cli-2.15.0 lib/project_types/theme/forms/select.rb
shopify-cli-2.14.0 lib/project_types/theme/forms/select.rb
shopify-cli-2.13.0 lib/project_types/theme/forms/select.rb