mirror of
https://github.com/NixOS/nix
synced 2025-07-04 15:31:47 +02:00
Move command plugin interface to libnixcmd
This commit is contained in:
parent
36c4d6f592
commit
6af6e41df0
21 changed files with 36 additions and 11 deletions
23
src/libcmd/legacy.hh
Normal file
23
src/libcmd/legacy.hh
Normal file
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue