summary refs log tree commit diff
path: root/doc/stdenv.xml
diff options
context:
space:
mode:
authorTom Boettcher <tom.boettcher@cerner.com>2016-06-21 09:38:11 -0500
committerTom Boettcher <tom.boettcher@cerner.com>2016-06-21 09:38:11 -0500
commita1083a5d274bdbff0ebf3d7ea63a4d0d6268b2cc (patch)
tree2ddfd7dde5e9202118a23fd48b812615b0c3e6ea /doc/stdenv.xml
parentbc6b93511f21f9943b1c9a9b872717d507ab9070 (diff)
downloadnixlib-a1083a5d274bdbff0ebf3d7ea63a4d0d6268b2cc.tar
nixlib-a1083a5d274bdbff0ebf3d7ea63a4d0d6268b2cc.tar.gz
nixlib-a1083a5d274bdbff0ebf3d7ea63a4d0d6268b2cc.tar.bz2
nixlib-a1083a5d274bdbff0ebf3d7ea63a4d0d6268b2cc.tar.lz
nixlib-a1083a5d274bdbff0ebf3d7ea63a4d0d6268b2cc.tar.xz
nixlib-a1083a5d274bdbff0ebf3d7ea63a4d0d6268b2cc.tar.zst
nixlib-a1083a5d274bdbff0ebf3d7ea63a4d0d6268b2cc.zip
doc: Update stripHash documentation
The documentation now matches the behavior of the function.
Diffstat (limited to 'doc/stdenv.xml')
-rw-r--r--doc/stdenv.xml22
1 files changed, 18 insertions, 4 deletions
diff --git a/doc/stdenv.xml b/doc/stdenv.xml
index d5f37aee15ee..b075e0219a54 100644
--- a/doc/stdenv.xml
+++ b/doc/stdenv.xml
@@ -1196,10 +1196,24 @@ echo @foo@
     <term><function>stripHash</function>
     <replaceable>path</replaceable></term>
     <listitem><para>Strips the directory and hash part of a store
-    path, and prints (on standard output) only the name part.  For
-    instance, <literal>stripHash
-    /nix/store/68afga4khv0w...-coreutils-6.12</literal> print
-    <literal>coreutils-6.12</literal>.</para></listitem>
+    path, storing the name part in the environment variable
+    <literal>strippedName</literal>. For example:
+    
+<programlisting>
+stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
+# prints coreutils-8.24
+echo $strippedName
+</programlisting>
+
+    If you wish to store the result in another variable, then the
+    following idiom may be useful:
+    
+<programlisting>
+name="/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
+someVar=$(stripHash $name; echo $strippedName)
+</programlisting>
+
+    </para></listitem>
   </varlistentry>