Sha256: 037e24f55cedd2919bb70a90c6c48bef78b22417b4ed6fbd4fe189bbe9bb5393

Contents?: true

Size: 909 Bytes

Versions: 11

Compression:

Stored size: 909 Bytes

Contents

module Theme
  module Forms
    class Create < ShopifyCli::Form
      attr_accessor :name
      flag_arguments :title, :password, :store, :env

      def ask
        self.store ||= CLI::UI::Prompt.ask(ctx.message("theme.forms.ask_store"), allow_empty: false)
        ctx.puts(ctx.message("theme.forms.create.private_app", store))
        self.password ||= CLI::UI::Prompt.ask(ctx.message("theme.forms.ask_password"), allow_empty: false)
        self.title ||= CLI::UI::Prompt.ask(ctx.message("theme.forms.create.ask_title"), allow_empty: false)
        self.name = self.title.downcase.split(" ").join("_")

        errors = []
        errors << "store" if store.strip.empty?
        errors << "password" if password.strip.empty?
        errors << "title" if title.strip.empty?
        ctx.abort(ctx.message("theme.forms.errors", errors.join(", ").capitalize)) unless errors.empty?
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
shopify-cli-1.14.0 lib/project_types/theme/forms/create.rb
shopify-cli-1.13.1 lib/project_types/theme/forms/create.rb
shopify-cli-1.13.0 lib/project_types/theme/forms/create.rb
shopify-cli-1.12.0 lib/project_types/theme/forms/create.rb
shopify-cli-1.11.0 lib/project_types/theme/forms/create.rb
shopify-cli-1.10.0 lib/project_types/theme/forms/create.rb
shopify-cli-1.9.1 lib/project_types/theme/forms/create.rb
shopify-cli-1.9.0 lib/project_types/theme/forms/create.rb
shopify-cli-1.8.0 lib/project_types/theme/forms/create.rb
shopify-cli-1.7.1 lib/project_types/theme/forms/create.rb
shopify-cli-1.7.0 lib/project_types/theme/forms/create.rb