lix/src/libcmd
Rebecca Turner 9e7e927837 Print top-level errors normally in nix repl
Previously, errors while printing values in `nix repl` would be printed
in `«error: ...»` brackets rather than displayed normally:

```
nix-repl> legacyPackages.aarch64-darwin.pythonPackages.APScheduler
«error: Package ‘python-2.7.18.7’ in /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/pkgs/development/interpreters/python/cpython/2.7/default.nix:335 is marked as insecure, refusing to evaluate.»
```

Now, errors will be displayed normally if they're emitted at the
top-level of an expression:

```
nix-repl> legacyPackages.aarch64-darwin.pythonPackages.APScheduler
error:
       … in the condition of the assert statement
         at /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/lib/customisation.nix:268:17:
          267|     in commonAttrs // {
          268|       drvPath = assert condition; drv.drvPath;
             |                 ^
          269|       outPath = assert condition; drv.outPath;

       … in the left operand of the OR (||) operator
         at /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/pkgs/development/interpreters/python/passthrufun.nix:28:45:
           27|         if lib.isDerivation value then
           28|           lib.extendDerivation (valid value || throw "${name} should use `buildPythonPackage` or `toPythonModule` if it is to be part of the Python packages set.") {} value
             |                                             ^
           29|         else

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: Package ‘python-2.7.18.7’ in /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/pkgs/development/interpreters/python/cpython/2.7/default.nix:335 is marked as insecure, refusing to evaluate.
```

Errors emitted in nested structures (like e.g. when printing `nixpkgs`)
will still be printed in brackets.

Change-Id: I25aeddf08c017582718cb9772a677bf51b9fc2ad
2024-04-09 08:34:40 -07:00
..
built-path.cc Merge pull request #9582 from pennae/misc-opts 2024-03-04 07:32:31 +01:00
built-path.hh pragma once and ///@file everything missing it 2024-04-08 15:40:12 -07:00
command-installable-value.cc Finish converting existing comments for internal API docs (#8146) 2023-04-07 13:55:28 +00:00
command-installable-value.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
command.cc Merge pull request #9289 from edolstra/fix-warnings 2024-03-04 05:27:35 +01:00
command.hh Merge pull request #8817 from iFreilicht/flake-update-lock-overhaul 2024-03-25 17:36:24 -06:00
common-eval-args.cc Overhaul completions, redo #6693 (#8131) 2024-03-25 15:30:36 +00:00
common-eval-args.hh Clean up SearchPath 2023-07-09 23:22:22 -04:00
editor-for.cc Merge pull request #9634 from 9999years/combine-abstract-pos-and-pos 2024-03-05 23:46:18 -07:00
editor-for.hh Merge pull request #9634 from 9999years/combine-abstract-pos-and-pos 2024-03-05 23:46:18 -07:00
installable-attr-path.cc Fixing #7479 2023-08-18 11:44:00 -04:00
installable-attr-path.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
installable-derived-path.cc Fixing #7479 2023-08-18 11:44:00 -04:00
installable-derived-path.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
installable-flake.cc feat: notation to refer to no attribute search prefix 2024-03-25 15:30:36 +00:00
installable-flake.hh Rename 'resolvedRef' to 'lockedRef' 2023-07-03 12:23:57 +02:00
installable-value.cc Merge pull request #9634 from 9999years/combine-abstract-pos-and-pos 2024-03-05 23:46:18 -07:00
installable-value.hh Make more string values work as installables 2023-05-15 09:03:38 -04:00
installables.cc Merge pull request #8817 from iFreilicht/flake-update-lock-overhaul 2024-03-25 17:36:24 -06:00
installables.hh Merge pull request #9648 from cole-h/nix-shell-ordering 2024-03-04 07:50:55 +01:00
legacy.cc Move command plugin interface to libnixcmd 2021-01-26 06:22:24 -05:00
legacy.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
local.mk Add repl-overlays 2024-04-08 17:11:47 -07:00
markdown.cc do not render relative links in help pages 2022-08-26 17:10:41 +02:00
markdown.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
meson.build Add repl-overlays 2024-04-08 17:11:47 -07:00
nix-cmd.pc.in Fix building with GCC 9 2023-02-10 18:38:57 +01:00
repl-interacter.cc add automated usage mode to the repl 2024-03-11 14:14:43 -07:00
repl-interacter.hh add automated usage mode to the repl 2024-03-11 14:14:43 -07:00
repl-overlays.nix format repl-overlays.nix to fix pre-commit checks 2024-04-09 02:21:26 -06:00
repl.cc Print top-level errors normally in nix repl 2024-04-09 08:34:40 -07:00
repl.hh refactor: move readline stuff into its own file 2024-03-11 01:04:52 -07:00