This name made sense at the time, but now I'm looking at making the corresponding change to `CommandRegistry`, and I don't think `Commands` is a good name for _that_ type, but I don't want the types to be mismatched, so here we are. Change-Id: I06068cbde00f49ff3d720c505a567a152b00b61c
27 lines
548 B
C++
27 lines
548 B
C++
#pragma once
|
|
///@file
|
|
|
|
#include "lix/libutil/async.hh"
|
|
#include <functional>
|
|
#include <list>
|
|
#include <map>
|
|
#include <string>
|
|
|
|
namespace nix {
|
|
|
|
typedef std::function<void(AsyncIoRoot &, std::string, std::list<std::string>)> MainFunction;
|
|
|
|
struct LegacyCommandRegistry
|
|
{
|
|
using LegacyCommandMap = std::map<std::string, MainFunction>;
|
|
static LegacyCommandMap * commands;
|
|
|
|
static void add(const std::string & name, MainFunction fun)
|
|
{
|
|
if (!commands) commands = new LegacyCommandMap;
|
|
(*commands)[name] = fun;
|
|
}
|
|
};
|
|
|
|
}
|