about summary refs log tree commit diff
path: root/third_party/nix/src/nix/legacy.hh
blob: 09a102218132d4c479f65c481e704dfe9933dcdd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#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;
  }
};

}  // namespace nix