This adds a new "-s" flag that will append an SPDX-License-Identifier
line to license headers. If "-s=only" is specified, then only the SPDX
identifier will be used.
This also changes the "-l" flag to use SPDX identifiers, with mappings
to support the legacy "apache", "mit", and "mpl" values. Together with
the "-s" flag, this allows SPDX headers for any arbitrary license type
to be added to files.
Co-authored-by: Bob Callaway <bcallawa@redhat.com>
Move the logic for selecting a license template based on user input into
a standalone func (fetchTemplate), and add test cases for all code
paths.
Delay parsing predefined license templates. This allows the new
fetchTemplate method to modify these templates before returning in the
future (to add SPDX license information). Add tests to ensure that
these templates must always parse properly.
Rename copyrightData type to licenseData, since we will soon begin to
add more than just copyright data here (SPDX ID).
Rename prefix func to executeTemplate, since this better describes what
the function is doing.
These are all refactoring and cleanup changes; no behavioral changes.
If a license text had blank lines, they would result in a trailing
whitespace when prefixed with the line comments.
This change removes trailing whitespace from the middle lines,
leaving top and bottom as is.
Fixes#10