1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

Add "nix add-to-store" command

This commit is contained in:
Eelco Dolstra 2017-09-14 13:22:32 +02:00
parent 1c58ad2ffa
commit 970366266b
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
4 changed files with 67 additions and 4 deletions

View file

@ -81,15 +81,16 @@ public:
FlagMaker & handler(std::function<void(Strings)> handler) { flag->handler = handler; return *this; };
FlagMaker & category(const std::string & s) { flag->category = s; return *this; };
FlagMaker & dest(std::string * dest) {
assert(flag->arity == 1);
template<class T>
FlagMaker & dest(T * dest) {
flag->arity = 1;
flag->handler = [=](Strings ss) { *dest = ss.front(); };
return *this;
};
template<class T>
FlagMaker & set(T * dest, const T & val) {
assert(flag->arity == 0);
flag->arity = 1;
flag->handler = [=](Strings ss) { *dest = val; };
return *this;
};