Copyright | (c) 2019-2021 Vaclav Svejcar |
---|---|
License | BSD-3-Clause |
Maintainer | vaclav.svejcar@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
This module provides functionality for updating years in copyright statements in already rendered license headers.
Synopsis
- newtype SelectedAuthors = SelectedAuthors (NonEmpty Text)
- data UpdateCopyrightMode
- updateCopyright :: (Has CurrentYear env, Has UpdateCopyrightMode env) => HeaderFn env
- updateYears :: CurrentYear -> Text -> Text
Data Types
newtype SelectedAuthors Source #
Non-empty list of authors for which to update years in their copyrights.
Instances
Eq SelectedAuthors Source # | |
Defined in Headroom.HeaderFn.UpdateCopyright (==) :: SelectedAuthors -> SelectedAuthors -> Bool # (/=) :: SelectedAuthors -> SelectedAuthors -> Bool # | |
Show SelectedAuthors Source # | |
Defined in Headroom.HeaderFn.UpdateCopyright showsPrec :: Int -> SelectedAuthors -> ShowS # show :: SelectedAuthors -> String # showList :: [SelectedAuthors] -> ShowS # |
data UpdateCopyrightMode Source #
Mode that changes behaviour of the updateCopyright
function.
UpdateAllAuthors | updates years in copyrights for all authors |
UpdateSelectedAuthors SelectedAuthors | updates years in copyrights only for selected authors |
Instances
Eq UpdateCopyrightMode Source # | |
Defined in Headroom.HeaderFn.UpdateCopyright (==) :: UpdateCopyrightMode -> UpdateCopyrightMode -> Bool # (/=) :: UpdateCopyrightMode -> UpdateCopyrightMode -> Bool # | |
Show UpdateCopyrightMode Source # | |
Defined in Headroom.HeaderFn.UpdateCopyright showsPrec :: Int -> UpdateCopyrightMode -> ShowS # show :: UpdateCopyrightMode -> String # showList :: [UpdateCopyrightMode] -> ShowS # | |
Has UpdateCopyrightMode ConfiguredEnv Source # | |
Defined in Headroom.HeaderFn |
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
:: 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"