# frozen_string_literal: true

module Diffend
  # Extend bundler with a new secure command to be able to run Diffend separately
  class BundleSecure
    ::Bundler::Plugin::API.command(Diffend::Commands::SECURE, self)

    # Execute diffend check
    #
    # @param _name [String] command name
    # @param _args [Array] arguments from ARGV
    def exec(_name, _args)
      config = Diffend::Config.new(
        command: Diffend::Commands::SECURE,
        severity: Diffend::Logger::INFO
      )

      Diffend::LatestVersion.call(config)

      Diffend::Execute.call(config)
    end
  end
end