about summary refs log blame commit diff
path: root/src/nix/legacy.hh
blob: b67b70eb5c859858ca5aaa0ac8fda6bcf4165148 (plain) (tree)





















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

}