Sha256: 3b3fcb4e5985284c97c6ab3192d3bd6be4253e10f37868fd107bcfb013f36fe1

Contents?: true

Size: 992 Bytes

Versions: 3

Compression:

Stored size: 992 Bytes

Contents

# frozen_string_literal: true

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

      desc 'list', 'List all the restricted licenses'
      def list
        printer.say 'Restricted Licenses:', :blue
        say_each(decisions.restricted, &:name)
      end

      auditable
      desc 'add LICENSE...', 'Add one or more licenses to the restricted licenses'
      def add(*licenses)
        assert_some licenses
        modifying { licenses.each { |l| decisions.restrict(l, txn) } }
        printer.say "Added #{licenses.join(', ')} to the restricted licenses"
      end

      auditable
      desc 'remove LICENSE...', 'Remove one or more licenses from the restricted licenses'
      def remove(*licenses)
        assert_some licenses
        modifying { licenses.each { |l| decisions.unrestrict(l, txn) } }
        printer.say "Removed #{licenses.join(', ')} from the restricted licenses"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
license_finder-7.1.0 lib/license_finder/cli/restricted_licenses.rb
license_finder-7.0.1 lib/license_finder/cli/restricted_licenses.rb
license_finder-7.0.0 lib/license_finder/cli/restricted_licenses.rb