lscolors

This is the main module of lscolors.

Use it to parse a LS_COLORS string and then query the style which should be applied to a certain filesystem entry

Types

Entry = object
  path*: string
  typ*: EntryType
Holds a path and its type
LsColors = object
  types*: TableRef[EntryType, Style]
  patterns*: TableRef[string, Style]
  lnTarget*: bool
Holds parsed LS_COLORS

Procs

proc emptyLsColors(): LsColors {...}{.raises: [], tags: [].}
Creates an empty LsColors object
proc parseLsColors(str: string): LsColors {...}{.raises: [UnpackError], tags: [].}
Parse a LS_COLORS string
proc defaultLsColors(): LsColors {...}{.raises: [UnpackError], tags: [].}
A set of default LS_COLORS
proc parseLsColorsEnv(): LsColors {...}{.raises: [UnpackError], tags: [ReadEnvEffect].}
Parses the LS_COLORS environment variable. Defaults to defaultLsColors when no such environment variable exists
proc styleForDirEntry(lsc: LsColors; entry: Entry): Style {...}{.raises: [OSError], tags: [].}
Returns the style which should be used for this specific entry
proc styleForPath(lsc: LsColors; path: string): Style {...}{.raises: [OSError], tags: [].}
Returns the style which should be used for this specific path
proc styleForPathComponents(lsc: LsColors; path: string): seq[
    tuple[path: string, style: Style]] {...}{.raises: [OSError], tags: [].}
Return a seq of path components and corresponding style