about summary refs log tree commit diff
path: root/src/nix-hash/nix-hash.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix-hash/nix-hash.cc')
-rw-r--r--src/nix-hash/nix-hash.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nix-hash/nix-hash.cc b/src/nix-hash/nix-hash.cc
new file mode 100644
index 000000000000..77c169b9a952
--- /dev/null
+++ b/src/nix-hash/nix-hash.cc
@@ -0,0 +1,20 @@
+#include <iostream>
+
+#include "hash.hh"
+#include "shared.hh"
+
+
+void run(Strings args)
+{
+    bool flat = false;
+    for (Strings::iterator i = args.begin();
+         i != args.end(); i++)
+        if (*i == "--flat") flat = true;
+        else
+            cout << format("%1%\n") % (string) 
+                (flat ? hashFile(*i) : hashPath(*i));
+}
+
+
+string programId = "nix-hash";
+