aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/print-elided.cc
diff options
context:
space:
mode:
authorRebecca Turner <rbt@sent.as>2024-03-28 16:26:42 -0700
committerRebecca Turner <rbt@sent.as>2024-03-29 16:26:29 -0700
commita5a25894c152848d1a57f97b2ef5542ddf6cdb9d (patch)
treeea623d3e50f133b6f1d651847eef67e9172a3218 /src/libutil/print-elided.cc
parent5a54b0a20c80356de5098694353f506e73fb883f (diff)
Move `escapeString` to its own file
Change-Id: Ie5c954ec73c46c9d3c679ef99a83a29cc7a08352
Diffstat (limited to 'src/libutil/print-elided.cc')
-rw-r--r--src/libutil/print-elided.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libutil/print-elided.cc b/src/libutil/print-elided.cc
new file mode 100644
index 000000000..75357e5bc
--- /dev/null
+++ b/src/libutil/print-elided.cc
@@ -0,0 +1,23 @@
+#include "print-elided.hh"
+#include "ansicolor.hh"
+#include "english.hh"
+
+namespace nix {
+
+void printElided(
+ std::ostream & output,
+ unsigned int value,
+ const std::string_view single,
+ const std::string_view plural,
+ bool ansiColors)
+{
+ if (ansiColors)
+ output << ANSI_FAINT;
+ output << "«";
+ pluralize(output, value, single, plural);
+ output << " elided»";
+ if (ansiColors)
+ output << ANSI_NORMAL;
+}
+
+}