diff options
author | Marc Weber <marco-oweber@gmx.de> | 2008-12-02 12:26:12 +0000 |
---|---|---|
committer | Marc Weber <marco-oweber@gmx.de> | 2008-12-02 12:26:12 +0000 |
commit | 1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87 (patch) | |
tree | 48f700cb26b440ebaa52bead5aefb728dd6ea2c7 /pkgs/lib | |
parent | 01fc783e7f2527e7f712ea8fd2965f829bb61a53 (diff) | |
download | nixpkgs-1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87.tar nixpkgs-1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87.tar.gz nixpkgs-1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87.tar.bz2 nixpkgs-1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87.tar.lz nixpkgs-1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87.tar.xz nixpkgs-1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87.tar.zst nixpkgs-1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87.zip |
enhancing whatis trace function
svn path=/nixpkgs/trunk/; revision=13541
Diffstat (limited to 'pkgs/lib')
-rw-r--r-- | pkgs/lib/default.nix | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix index fe5b7fb1427..e03d0be27d6 100644 --- a/pkgs/lib/default.nix +++ b/pkgs/lib/default.nix @@ -566,10 +566,11 @@ rec { # this can help debug your code as well - designed to not produce thousands of lines traceWhatis = x : __trace (whatis x) x; traceMarked = str: x: __trace (str + (whatis x)) x; - whatis = x : + attrNamesToStr = a : concatStringsSep "; " (map (x : "${x}=") (__attrNames a)); + whatis = x : if (__isAttrs x) then - if (x ? outPath) then "x is a derivation with name ${x.name}" - else "x is an attr set with attributes ${builtins.toString (__attrNames x)}" + if (x ? outPath) then "x is a derivation, name ${if x ? name then x.name else "<no name>"}, { ${attrNamesToStr x} }" + else "x is attr set { ${attrNamesToStr x} }" else if (__isFunction x) then "x is a function" else if (x == []) then "x is an empty list" else if (__isList x) then "x is a list, first item is : ${whatis (__head x)}" |