Sha256: 9c41d2dff221363d72e00d17cbf4d4c4d4727517a6cb7fac6a0b3ab249bf007c

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module LicenseFinder
  module CLI
    class Licenses < Base
      extend Subcommand
      include MakesDecisions

      auditable
      method_option :version, desc: 'The version associated with the license'
      desc 'add DEPENDENCY LICENSE', "Set a dependency's licenses, overwriting any license_finder has found"
      def add(name, license)
        modifying { decisions.license(name, license, txn) }

        version_info = options[:version] ? " with version #{options[:version]}" : ''
        printer.say "The #{name} dependency#{version_info} has been marked as using #{license} license!", :green
      end

      auditable
      method_option :version, desc: 'The version associated with the license'
      desc 'remove DEPENDENCY LICENSE', 'Remove a manually set license'
      def remove(dep, lic = nil)
        modifying { decisions.unlicense(dep, lic, txn) }

        version_info = options[:version] ? " with version #{options[:version]}" : ''
        suffix = lic ? " of #{lic}" : ''
        printer.say "The dependency #{dep}#{version_info} no longer has a manual license#{suffix}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
license_finder-7.1.0 lib/license_finder/cli/licenses.rb