summaryrefslogtreecommitdiff
path: root/guix/scripts/hash.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-10-28 21:28:18 +0200
committerLudovic Courtès <ludo@gnu.org>2016-10-28 22:30:17 +0200
commit343dc11702bf71876795b5d158cad860deca53a1 (patch)
treef76669e9a32c799380fb7246adddd3521f55a733 /guix/scripts/hash.scm
parent12b6c951cf5ca6055a22a2eec85665353f5510e5 (diff)
guix hash: Interpret '-' as standard input.
* guix/scripts/hash.scm (guix-hash)[file-hash]: Special-case "-". * tests/guix-hash.sh: Add test. * doc/guix.texi (Invoking guix hash): Document it.
Diffstat (limited to 'guix/scripts/hash.scm')
-rw-r--r--guix/scripts/hash.scm4
1 files changed, 3 insertions, 1 deletions
diff --git a/guix/scripts/hash.scm b/guix/scripts/hash.scm
index b269ead50f..a339a8556b 100644
--- a/guix/scripts/hash.scm
+++ b/guix/scripts/hash.scm
@@ -139,7 +139,9 @@ and 'hexadecimal' can be used as well).\n"))
(write-file file port #:select? select?)
(force-output port)
(get-hash))
- (call-with-input-file file port-sha256))))
+ (match file
+ ("-" (port-sha256 (current-input-port)))
+ (_ (call-with-input-file file port-sha256))))))
(match args
((file)