Documentation ¶
Overview ¶
Package readme provides functions for reading and suggesting readme files.
Index ¶
- func IncompatibleANSI(r io.Reader) (bool, error)
- func List(content ...string) []string
- func Read(art *models.File, downloadPath, extraPath string) ([]byte, error)
- func RemoveCtrls(b []byte) []byte
- func SortContent(content ...string) []string
- func Suggest(filename, group string, content ...string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IncompatibleANSI ¶
IncompatibleANSI scans for HTML incompatible, ANSI cursor escape codes in the reader.
func RemoveCtrls ¶
RemoveCtrls removes ANSI escape codes and converts Windows line endings to Unix.
func SortContent ¶
SortContent sorts the content list by the number of slashes in each string. It prioritizes strings with fewer slashes (i.e., closer to the root). If the number of slashes is the same, it sorts alphabetically.
func Suggest ¶
Suggest returns a suggested readme file name for the record. It prioritizes the filename and group name with a priority extension, such as ".nfo", ".txt", etc. If no priority extension is found, it will return the first textfile in the content list.
The filename should be the name of the file archive artifact. The group should be a name or common abbreviation of the group that released the artifact. The content should be a list of files contained in the artifact.
This is a port of the CFML function, variables.findTextfile found in File.cfc.
Types ¶
This section is empty.