This website requires JavaScript.
Explore
Help
Sign In
nordic-dev.net
/
nix
Watch
2
Star
0
Fork
0
You've already forked nix
mirror of
https://github.com/NixOS/nix.git
synced
2024-11-22 14:52:55 +00:00
Code
Issues
Packages
Projects
Releases
Wiki
Activity
1c832d6050
nix
/
tests
/
functional
/
lang
/
eval-okay-print.err.exp
2 lines
21 B
Plaintext
Raw
Normal View
History
Unescape
Escape
Unify and refactor value printing Previously, there were two mostly-identical value printers -- one in `libexpr/eval.cc` (which didn't force values) and one in `libcmd/repl.cc` (which did force values and also printed ANSI color codes). This PR unifies both of these printers into `print.cc` and provides a `PrintOptions` struct for controlling the output, which allows for toggling whether values are forced, whether repeated values are tracked, and whether ANSI color codes are displayed. Additionally, `PrintOptions` allows tuning the maximum number of attributes, list items, and bytes in a string that will be displayed; this makes it ideal for contexts where printing too much output (e.g. all of Nixpkgs) is distracting. (As requested by @roberth in https://github.com/NixOS/nix/pull/9554#issuecomment-1845095735) Please read the tests for example output. Future work: - It would be nice to provide this function as a builtin, perhaps `builtins.toStringDebug` -- a printing function that never fails would be useful when debugging Nix code. - It would be nice to support customizing `PrintOptions` members on the command line, e.g. `--option to-string-max-attrs 1000`.
2023-12-12 21:57:36 +00:00
trace: [ «thunk» ]
Reference in New Issue
Copy Permalink