Sha256: c9dc507ed0137e89ca916f2897bada4f29c380993a1ce74fa438530099af8aa4

Contents?: true

Size: 688 Bytes

Versions: 8

Compression:

Stored size: 688 Bytes

Contents

# frozen_string_literal: true

module Script
  module Forms
    class AskApp < ShopifyCLI::Form
      attr_reader :app

      def ask
        apps = @xargs.fetch(:apps)
        raise Errors::NoExistingAppsError if apps.empty?

        @app =
          if apps.count > 1
            CLI::UI::Prompt.ask(ctx.message("script.application.ensure_env.app_select")) do |handler|
              apps.each do |app|
                handler.option(app["title"]) { app }
              end
            end
          else
            apps.first.tap do |app|
              ctx.puts(ctx.message("script.application.ensure_env.app", app["title"]))
            end
          end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
shopify-cli-2.25.0 lib/project_types/script/forms/ask_app.rb
shopify-cli-2.24.0 lib/project_types/script/forms/ask_app.rb
shopify-cli-2.23.0 lib/project_types/script/forms/ask_app.rb
shopify-cli-2.22.0 lib/project_types/script/forms/ask_app.rb
shopify-cli-2.21.0 lib/project_types/script/forms/ask_app.rb
shopify-cli-2.20.1 lib/project_types/script/forms/ask_app.rb
shopify-cli-2.20.0 lib/project_types/script/forms/ask_app.rb
shopify-cli-2.19.0 lib/project_types/script/forms/ask_app.rb