diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-02-09T20·28+0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-02-09T20·28+0100 |
commit | cd2196b08981a96cf607ad4a8f2f0dfa8cdf2add (patch) | |
tree | b8f213b8790dc55812dae9fd1403bb352ccad0e2 /src/nix/legacy.hh | |
parent | 0db9e6cd1af299f7d65e0b99019f0ccdbb1aaf3f (diff) |
Start of new Nix command-line interface
Diffstat (limited to 'src/nix/legacy.hh')
-rw-r--r-- | src/nix/legacy.hh | 22 |
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; + } +}; + +} |