about summary refs log tree commit diff
path: root/third_party/nix/src/nix/legacy.hh
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/nix/legacy.hh')
-rw-r--r--third_party/nix/src/nix/legacy.hh23
1 files changed, 23 insertions, 0 deletions
diff --git a/third_party/nix/src/nix/legacy.hh b/third_party/nix/src/nix/legacy.hh
new file mode 100644
index 0000000000..f503b0da3e
--- /dev/null
+++ b/third_party/nix/src/nix/legacy.hh
@@ -0,0 +1,23 @@
+#pragma once
+
+#include <functional>
+#include <map>
+#include <string>
+
+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;
+    }
+};
+
+}