fbiville / headache

Utility to manage license headers in source files
Apache License 2.0
34 stars 8 forks source link

Support date range of the form YYYY-Present #43

Closed glyn closed 5 years ago

glyn commented 5 years ago

Some copyright lines are of the form YYYY-Present rather than YYYY-ZZZZ. For example:

Copyright (c) 2019-Present Pivotal Software, Inc. All Rights Reserved.
fbiville commented 5 years ago

I think I'm going to replace the single {{.Year}} reserved parameter by two more granular ones: {{.StartYear}} and {{.EndYear}}. Then, users can choose to ignore either of them.

fbiville commented 5 years ago

In this specific case, the template would become:

Copyright (c) {{.StartYear}}-Present Pivotal Software, Inc. All Rights Reserved.
jmelfi commented 5 years ago

This would be a nice improvement! I was about to see what I needed to do for getting a range in for years. A StartYear and EndYear parameter would be perfect.

fbiville commented 5 years ago

Nice :) I will try to get that done this week, unless you want to give it a go @jmelfi?

fbiville commented 5 years ago

@jmelfi note that the range of years, as of today, is completely managed by headache by extracting the earliest and latest commit years of each file.

If you've got a file first committed in 2005 and its last commit is in 2009, Copyright {{.Year}} will yield Copyright 2005-2009, unless the existing header start year is earlier than the first commit's year.

Was that your understanding as well? If not, I need to clarify the existing documentation to emphasize that automatic date ranges are already supported.

EDIT: the documentation is now clarified, Year has been renamed to the more explicit YearRange.