aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2022-11-15 01:11:33 +0100
committerpacien2022-11-15 01:12:33 +0100
commit2583ea10b3b1ee87bc086a952a0fc3fe26521217 (patch)
tree7e3b871cdab5fc4bb2509cb736286a593cb972a8
parent99c4f2535eb5241bfb89f81f181bfbc4d0ee3ffc (diff)
downloadflaky-utils-2583ea10b3b1ee87bc086a952a0fc3fe26521217.tar.gz
lib/shell.fmt: escape text in formatted block
-rw-r--r--lib/shell.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/shell.nix b/lib/shell.nix
index fd90034..e6ba22c 100644
--- a/lib/shell.nix
+++ b/lib/shell.nix
@@ -9,7 +9,7 @@ let
9 concatStringsSep "\n" (mapAttrsToList mapping attrs); 9 concatStringsSep "\n" (mapAttrsToList mapping attrs);
10 10
11 fmt = rec { 11 fmt = rec {
12 codeBlock = code: text: ''"\e[${code}m"${text}"\e[0m"''; 12 codeBlock = code: text: ''"\e[${code}m"${escapeShellArg text}"\e[0m"'';
13 keyword = codeBlock "1;36"; 13 keyword = codeBlock "1;36";
14 section = codeBlock "4;35"; 14 section = codeBlock "4;35";
15 printSectionTitle = title: ''echo -e "\n\n"${section title}"\n"''; 15 printSectionTitle = title: ''echo -e "\n\n"${section title}"\n"'';
@@ -26,7 +26,7 @@ in rec {
26 exportEnvVars = mapAttrsToLines exportEnvVar; 26 exportEnvVars = mapAttrsToLines exportEnvVar;
27 27
28 printEnvVar = k: v: '' 28 printEnvVar = k: v: ''
29 echo -e ${fmt.keyword (escapeShellArg "$" + k)}: ${escapeShellArg v} 29 echo -e ${fmt.keyword ("$" + k)}: ${escapeShellArg v}
30 ''; 30 '';
31 31
32 printEnvVars = envVars: '' 32 printEnvVars = envVars: ''