summaryrefslogtreecommitdiffstats
path: root/lib/types.nix
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2020-01-11 13:32:30 +0100
committerJan Tojnar <jtojnar@gmail.com>2020-01-11 13:32:30 +0100
commit6fc46fbb177e22d467c9d92d0fac8581afa81246 (patch)
treeb56ca3e83675919b936aee0a4e35c12440fde2aa /lib/types.nix
parentb0c2c96cbe12c5a3a280ffd2634ebe0c8507e8b0 (diff)
lib/types: only show ... in loaOf warning when necessary
Diffstat (limited to 'lib/types.nix')
-rw-r--r--lib/types.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/types.nix b/lib/types.nix
index cbbea00058d0..6eebc20829c6 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -354,6 +354,7 @@ rec {
};
option = concatStringsSep "." loc;
sample = take 3 def.value;
+ more = lib.optionalString (length def.value > 3) "... ";
list = concatMapStrings (x: ''{ ${nameAttr} = "${x.${nameAttr} or "unnamed"}"; ...} '') sample;
set = concatMapStrings (x: ''${x.${nameAttr} or "unnamed"} = {...}; '') sample;
msg = ''
@@ -363,10 +364,10 @@ rec {
See https://git.io/fj2zm for more information.
Do
${option} =
- { ${set}...}
+ { ${set}${more}}
instead of
${option} =
- [ ${list}...]
+ [ ${list}${more}]
'';
in
lib.warn msg res