Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::EscapeStringOptions Struct Reference

#include <escape-string.hh>

Public Attributes

size_t maxLength = std::numeric_limits<size_t>::max()
bool outputAnsiColors = false
bool escapeNonPrinting = false

Detailed Description

Options for escaping strings in escapeString.

With default optional parameters, the output string will round-trip through the Nix evaluator (i.e. you can copy/paste this function's output into the REPL and have it evaluate as the string that got passed in).

With non-default optional parameters, the output string will be human-readable.

Member Data Documentation

◆ escapeNonPrinting

bool nix::EscapeStringOptions::escapeNonPrinting = false

If escapeNonPrinting is set, non-printing ASCII characters (i.e. with byte values less than 0x20) will be printed in \xhh format, like \x1d (other than those that Nix supports, like \n, \r, \t). Note that this format is not yet supported by the Lix parser/evaluator!

See: https://git.lix.systems/lix-project/lix/issues/149

◆ maxLength

size_t nix::EscapeStringOptions::maxLength = std::numeric_limits<size_t>::max()

If maxLength is decreased, some trailing portion of the string may be omitted with a message like «123 bytes elided».

◆ outputAnsiColors

bool nix::EscapeStringOptions::outputAnsiColors = false

If outputAnsiColors is set, the string will be colored the color of literals, using ANSI escape codes.


The documentation for this struct was generated from the following file: