aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd/repl.cc
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-04-16 14:07:35 +0200
committerRobert Hensing <robert@roberthensing.nl>2023-04-16 14:07:35 +0200
commitb6125772d7d5f82d48873fc93a7f261832154b14 (patch)
tree2700c6ab861df273c949739d06d6b1e6745d1819 /src/libcmd/repl.cc
parent28a5cdde02964306e7eb443f696c8d5d59ebf9e9 (diff)
libexpr: Move identifier-like printing to print.cc
Diffstat (limited to 'src/libcmd/repl.cc')
-rw-r--r--src/libcmd/repl.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc
index 806dce024..80c08bf1c 100644
--- a/src/libcmd/repl.cc
+++ b/src/libcmd/repl.cc
@@ -426,6 +426,7 @@ StringSet NixRepl::completePrefix(const std::string & prefix)
}
+// FIXME: DRY and match or use the parser
static bool isVarName(std::string_view s)
{
if (s.size() == 0) return false;
@@ -956,10 +957,7 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
sorted.emplace(state->symbols[i.name], i.value);
for (auto & i : sorted) {
- if (isVarName(i.first))
- str << i.first;
- else
- printLiteralString(str, i.first);
+ printAttributeName(str, i.first);
str << " = ";
if (seen.count(i.second))
str << "«repeated»";