diff options
author | Robert Hensing <roberth@users.noreply.github.com> | 2024-03-11 10:02:09 +0100 |
---|---|---|
committer | Jade Lovelace <lix@jade.fyi> | 2024-04-07 19:10:43 -0700 |
commit | b995c17f0eb8d9598f339c080c467101c1f55feb (patch) | |
tree | 1dea41c905bfdc6825135dd330c1fcf4cc0f9451 /src/libcmd | |
parent | de20392c37c79f0aea03d4f580171178d896be15 (diff) |
Merge pull request #10208 from 9999years/print-strings-directly
`:print` strings directly in `nix repl`
(cherry picked from commit 3539172fd2f7cee639ce46423c58beca4231f2db)
Change-Id: I1972f3bf3b56312851f38288509d371d37f21677
Upstream-PR: https://github.com/NixOS/nix/pull/10208
Diffstat (limited to 'src/libcmd')
-rw-r--r-- | src/libcmd/repl.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index 0d7ad63a7..ee3a6e268 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -412,6 +412,7 @@ ProcessLineResult NixRepl::processLine(std::string line) << " :l, :load <path> Load Nix expression and add it to scope\n" << " :lf, :load-flake <ref> Load Nix flake and add it to scope\n" << " :p, :print <expr> Evaluate and print expression recursively\n" + << " Strings are printed directly, without escaping.\n" << " :q, :quit Exit nix-repl\n" << " :r, :reload Reload all files\n" << " :sh <expr> Build dependencies of derivation, then start\n" @@ -619,7 +620,11 @@ ProcessLineResult NixRepl::processLine(std::string line) else if (command == ":p" || command == ":print") { Value v; evalString(arg, v); - printValue(std::cout, v); + if (v.type() == nString) { + std::cout << v.string.s; + } else { + printValue(std::cout, v); + } std::cout << std::endl; } |