| Copyright | (c) 2019-2020 Vaclav Svejcar |
|---|---|
| License | BSD-3-Clause |
| Maintainer | vaclav.svejcar@gmail.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Headroom.HeaderFn.UpdateCopyright
Description
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.
Constructors
| SelectedAuthors (NonEmpty Text) |
Instances
| Eq SelectedAuthors Source # | |
Defined in Headroom.HeaderFn.UpdateCopyright Methods (==) :: SelectedAuthors -> SelectedAuthors -> Bool # (/=) :: SelectedAuthors -> SelectedAuthors -> Bool # | |
| Show SelectedAuthors Source # | |
Defined in Headroom.HeaderFn.UpdateCopyright Methods showsPrec :: Int -> SelectedAuthors -> ShowS # show :: SelectedAuthors -> String # showList :: [SelectedAuthors] -> ShowS # | |
data UpdateCopyrightMode Source #
Mode that changes behaviour of the updateCopyright function.
Constructors
| 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 Methods (==) :: UpdateCopyrightMode -> UpdateCopyrightMode -> Bool # (/=) :: UpdateCopyrightMode -> UpdateCopyrightMode -> Bool # | |
| Show UpdateCopyrightMode Source # | |
Defined in Headroom.HeaderFn.UpdateCopyright Methods showsPrec :: Int -> UpdateCopyrightMode -> ShowS # show :: UpdateCopyrightMode -> String # showList :: [UpdateCopyrightMode] -> ShowS # | |
| Has UpdateCopyrightMode ConfiguredEnv Source # | |
Defined in Headroom.HeaderFn Methods getter :: ConfiguredEnv -> UpdateCopyrightMode Source # modifier :: (UpdateCopyrightMode -> UpdateCopyrightMode) -> ConfiguredEnv -> ConfiguredEnv Source # hasLens :: Lens' ConfiguredEnv UpdateCopyrightMode Source # viewL :: MonadReader ConfiguredEnv m => m UpdateCopyrightMode Source # | |
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
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"