Documentation
¶
Overview ¶
Package comments provides functionality to add and remove comments to the top of files.
Index ¶
- func ContainsFileType(fileTypes []FileType, fileType FileType) bool
- func FileContent(path string) (string, error)
- func FileContentWithoutHeader(path string, headerRegexp *regexp.Regexp) (string, error)
- func StripPrefixes(fileContent string, prefixes []string) (string, string)
- func SupportsFile(filePath string) bool
- func WriteFileWithHeader(path, header, body string) error
- type FileType
- type Format
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsFileType ¶
indicates whether the given list of FileTypes contains the given FileType
func FileContent ¶ added in v0.2.0
func FileContentWithoutHeader ¶
FileContentWithoutHeader provides the content of the file with the given path, without the comment block identified by the given token.
func StripPrefixes ¶ added in v0.2.0
func SupportsFile ¶
indicates whether it is possible to add comments to the file with the given name
func WriteFileWithHeader ¶
WriteFileWithHeader creates a file at the given path containing the given file content (header + body). The header argument should contain only text. This method will transform it into the correct comment format.
Types ¶
type FileType ¶
type FileType string
a file format that we know about, represented as its file extension
func GetFileType ¶
provides the extension of the given filepath