diff options
Diffstat (limited to 'third_party/nix/src/nix/legacy.hh')
-rw-r--r-- | third_party/nix/src/nix/legacy.hh | 23 |
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 000000000000..a9bc65c02e76 --- /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; + } +}; + +} // namespace nix |