Sha256: 443ae4b063bc1e57c33f7544e837bb8dedaaff104140831937ca6ade80766080

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'dotenv/load'
require 'thor'
require 'json'

require_relative '../lib/licensee'

class LicenseeCLI < Thor
  package_name 'Licensee'
  class_option :remote, type: :boolean, desc: 'Assume PATH is a GitHub owner/repo path'
  default_task :detect

  def self.exit_on_failure?
    true
  end

  private

  def path
    @path ||= if !options[:remote] || args.first =~ %r{^https://}
                args.first || Dir.pwd
              else
                "https://github.com/#{args.first}"
              end
  end

  def project
    @project ||= Licensee.project(path,
                                  detect_packages: options[:packages],
                                  detect_readme:   options[:readme],
                                  ref:             options[:ref])
  end

  def remote?
    path =~ %r{^https://}
  end
end

commands_dir = File.expand_path '../lib/licensee/commands/', __dir__
Dir["#{commands_dir}/*.rb"].each { |c| require(c) }

LicenseeCLI.start(ARGV)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
licensee-9.18.0 bin/licensee
licensee-9.17.1 bin/licensee
licensee-9.17.0 bin/licensee