command line only output SPDX ID not name

eg

License:        MIT

instead of

License:        MIT License

Fixes #267
This commit is contained in:
Mike Linksvayer 2018-03-25 21:17:51 -07:00
parent 5d1c9a2133
commit 476648f875
2 changed files with 6 additions and 6 deletions

View File

@ -21,9 +21,9 @@ class LicenseeCLI < Thor
rows = []
rows << if project.license
['License:', project.license.name]
['License:', project.license.spdx_id]
elsif !project.licenses.empty?
['Licenses:', project.licenses.map(&:name)]
['Licenses:', project.licenses.map(&:spdx_id)]
else
['License:', set_color('None', :red)]
end
@ -77,7 +77,7 @@ class LicenseeCLI < Thor
def humanize(value, type = nil)
case type
when :license
value.name
value.spdx_id
when :matcher
value.class
when :confidence

View File

@ -13,19 +13,19 @@ RSpec.describe 'detect command' do
let(:hash) { '46cdc03462b9af57968df67b450cc4372ac41f53' }
let(:expected) do
{
'License' => 'MIT License',
'License' => 'MIT',
'Matched files' => 'LICENSE.md, licensee.gemspec',
'LICENSE.md' => {
'Content hash' => hash,
'Attribution' => 'Copyright (c) 2014-2017 Ben Balter',
'Confidence' => '100.00%',
'Matcher' => 'Licensee::Matchers::Exact',
'License' => 'MIT License'
'License' => 'MIT'
},
'licensee.gemspec' => {
'Confidence' => '90.00%',
'Matcher' => 'Licensee::Matchers::Gemspec',
'License' => 'MIT License'
'License' => 'MIT'
}
}
end