Start of new Nix command-line interface

This commit is contained in:
Eelco Dolstra 2016-02-09 21:28:29 +01:00
parent 0db9e6cd1a
commit cd2196b089
14 changed files with 362 additions and 74 deletions

22
src/nix/legacy.hh Normal file
View file

@ -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;
}
};
}