headroom-0.4.1.0: License Header Manager
Copyright(c) 2019-2021 Vaclav Svejcar
LicenseBSD-3-Clause
Maintainervaclav.svejcar@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Headroom.HeaderFn.UpdateCopyright

Description

This module provides functionality for updating years in copyright statements in already rendered license headers.

Synopsis

Data Types

newtype SelectedAuthors Source #

Non-empty list of authors for which to update years in their copyrights.

Constructors

SelectedAuthors (NonEmpty Text) 

Header Functions

updateCopyright :: (Has CurrentYear env, Has UpdateCopyrightMode env) => HeaderFn env Source #

License header function that updates years and year ranges in any present copyright statements.

Reader Environment Parameters

CurrentYear
value of the current year
UpdateCopyrightMode
mode specifying the behaviour of the updater

Helper Functions

updateYears Source #

Arguments

:: CurrentYear

current year

-> Text

text to update

-> Text

text with updated years

Updates years and years ranges in given text.

>>> updateYears (CurrentYear 2020) "Copyright (c) 2020"
"Copyright (c) 2020"
>>> updateYears (CurrentYear 2020) "Copyright (c) 2019"
"Copyright (c) 2019-2020"
>>> updateYears (CurrentYear 2020) "Copyright (c) 2018-2020"
"Copyright (c) 2018-2020"
>>> updateYears (CurrentYear 2020) "Copyright (c) 2018-2019"
"Copyright (c) 2018-2020"