Pathy.Printer
- Package
- purescript-pathy
- Repository
- slamdata/purescript-pathy
#Printer Source
type Printer = { current :: NonEmptyString, escaper :: Escaper, root :: Maybe NonEmptyString -> String, sep :: NonEmptyString, up :: NonEmptyString }A Printer defines options for printing paths.
rootis a function used to construct the initial segment of paths.currentis a representation of the current directory.upis a representation of going up to the parent directory.sepis the string to separate path segments by.escaperspecified how to deal with printing reserved names and characters.
#posixPrinter Source
posixPrinter :: PrinterA printer for POSIX paths.
#windowsPrinter Source
windowsPrinter :: PrinterA printer for Windows paths.
#printPath Source
printPath :: forall b a. IsRelOrAbs a => IsDirOrFile b => Printer -> SandboxedPath a b -> StringPrints a SandboxedPath into its canonical String representation, using
the specified printer. The printed path will always be absolute, as this
is the only way to ensure the path is safely referring to the intended
location.
#unsafePrintPath Source
unsafePrintPath :: forall b a. IsRelOrAbs a => IsDirOrFile b => Printer -> SandboxedPath a b -> StringPrints a SandboxedPath into its canonical String representation, using
the specified printer. This will print a relative path if b ~ Rel, which
depending on how the resulting string is used, may be unsafe.
#debugPrintPath Source
debugPrintPath :: forall b a. Warn (Text "debugPrintPath usage") => IsRelOrAbs a => IsDirOrFile b => Printer -> Path a b -> StringPrints a path exactly according to its representation. This should only be used for debug purposes. Using this function will raise a warning at compile time as a reminder!
#Escaper Source
newtype EscaperAn Escaper encodes segments or characters which have reserved meaning
within names in a path.
Constructors
Instances
#slashEscaper Source
slashEscaper :: EscaperAn escaper that replaces all '/' characters in a name with '-'s.
#dotEscaper Source
dotEscaper :: EscaperAn escaper that replaces names "." and ".." with "$dot" and
"$dot$dot".
#posixEscaper Source
posixEscaper :: EscaperAn escaper that removes all slashes, converts ".." into "$dot$dot", and converts "." into "$dot".
#windowsEscaper Source
windowsEscaper :: EscaperAn escaper that attempts to encode all reserved names and characters for windows-style paths.