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-02-09T20·28+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-09T20·28+0100
commitcd2196b08981a96cf607ad4a8f2f0dfa8cdf2add (patch)
treeb8f213b8790dc55812dae9fd1403bb352ccad0e2 /src/nix/legacy.hh
parent0db9e6cd1af299f7d65e0b99019f0ccdbb1aaf3f (diff)
Start of new Nix command-line interface
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;
+    }
+};
+
+}