Copyright | (c) 2019-2020 Vaclav Svejcar |
---|---|
License | BSD-3 |
Maintainer | vaclav.svejcar@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
License header is usually the very top comment in source code, holding some
short text about license type, author and copyright. This module provides data
types and functions for adding, dropping and replacing such headers. The license
header is represented by Header
data type, where FileType
defines for which
programming language source code this header is generated and the header text
itself.
Documentation
Generated license header for specified source code file type.
:: Header | license header to add to the input text |
-> Text | source code text |
-> Text | source code text with added license header |
Adds header to the given source code text if no existing header is
detected, otherwise returns the unchanged input text. If you need to replace
the header, use the replaceHeader
instead.
Checks whether the license header is present in given source code text.
:: FileType | type of the input source code text |
-> Text | source code text |
-> Text | source code text without the license header |
Drops license header (if detected) from the given source code text.
:: FileType | type of the input source code text |
-> Text | source code text |
-> Int | size of the headers (number of lines) |
Detects what is the header size in terms of lines in the given source code
text. Returns 0
if no header detected.
:: Header | new license header to use for replacement |
-> Text | source code text |
-> Text | source code text with replaced license header |
Replaces already existing (or adds if none detected) license header with
the new one in the given source code text. If you need to only add header if
none detected and skip if it already contains one, use the addHeader
instead.