about summary refs log tree commit diff
path: root/src/nix/legacy.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-04T14·21+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-04T14·21+0100
commit7c9d7a253c52dfbf8488d3394fe8af104a3af234 (patch)
treeb78f69734d35f428456dde41a87808feead701e0 /src/nix/legacy.hh
parent0a26b56cba5d9f1fa815273fadc500284dda1118 (diff)
parent1b4b16cc6d9585c7bbeb871edc815137baef8f83 (diff)
Merge branch 'new-cli'
Diffstat (limited to 'src/nix/legacy.hh')
-rw-r--r--src/nix/legacy.hh22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/nix/legacy.hh b/src/nix/legacy.hh
new file mode 100644
index 000000000000..b67b70eb5c85
--- /dev/null
+++ b/src/nix/legacy.hh
@@ -0,0 +1,22 @@
+#pragma once
+
+#include <functional>
+#include <map>
+
+namespace nix {
+
+typedef std::function<void(int, char * *)> MainFunction;
+
+struct RegisterLegacyCommand
+{
+    typedef std::map<std::string, MainFunction> Commands;
+    static Commands * commands;
+
+    RegisterLegacyCommand(const std::string & name, MainFunction fun)
+    {
+        if (!commands) commands = new Commands;
+        (*commands)[name] = fun;
+    }
+};
+
+}