Sha256: 48464ec2b33b76834ed7768c9438ee2601ae0647c1c2389df6300eb5fd00f729

Contents?: true

Size: 1.21 KB

Versions: 18

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true
require "theme_check"

module Extension
  class Command
    class Check < ExtensionCommand
      class CheckOptions < ShopifyCLI::Options
        def initialize(ctx, theme_check)
          super()
          @theme_check = theme_check
          @ctx = ctx
        end

        def parse(_options_block, args)
          # Check if .theme-check.yml exists, or if another -C has been passed on the command line
          unless args.include?("-C") || @ctx.file_exist?(".theme-check.yml")
            args += ["-C", ":theme_app_extension"]
          end
          @theme_check.parse(args)
        end
      end

      def initialize(*)
        super
        if project.specification_identifier == "THEME_APP_EXTENSION"
          @theme_check = ThemeCheck::Cli.new
          self.options = CheckOptions.new(@ctx, @theme_check)
        end
      end

      def call(*)
        if project.specification_identifier == "THEME_APP_EXTENSION"
          @theme_check.run
        else
          @ctx.abort(@ctx.message("check.unsupported", project.specification_identifier))
        end
      end

      def self.help
        ShopifyCLI::Context.message("check.help", ShopifyCLI::TOOL_NAME)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
shopify-cli-2.10.2 lib/project_types/extension/commands/check.rb
shopify-cli-2.10.1 lib/project_types/extension/commands/check.rb
shopify-cli-2.10.0 lib/project_types/extension/commands/check.rb
shopify-cli-2.9.0 lib/project_types/extension/commands/check.rb
shopify-cli-2.8.0 lib/project_types/extension/commands/check.rb
shopify-cli-2.7.4 lib/project_types/extension/commands/check.rb
shopify-cli-2.7.3 lib/project_types/extension/commands/check.rb
shopify-cli-2.7.2 lib/project_types/extension/commands/check.rb
shopify-cli-2.7.1 lib/project_types/extension/commands/check.rb
shopify-cli-2.7.0 lib/project_types/extension/commands/check.rb
shopify-cli-2.6.6 lib/project_types/extension/commands/check.rb
shopify-cli-2.6.5 lib/project_types/extension/commands/check.rb
shopify-cli-2.6.4 lib/project_types/extension/commands/check.rb
shopify-cli-2.6.3 lib/project_types/extension/commands/check.rb
shopify-cli-2.6.2 lib/project_types/extension/commands/check.rb
shopify-cli-2.6.1 lib/project_types/extension/commands/check.rb
shopify-cli-2.6.0 lib/project_types/extension/commands/check.rb
shopify-cli-2.5.0 lib/project_types/extension/commands/check.rb