From 970366266b8df712f5f9cedb45af183ef5a8357f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 14 Sep 2017 13:22:32 +0200 Subject: Add "nix add-to-store" command --- src/libutil/args.hh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/libutil') diff --git a/src/libutil/args.hh b/src/libutil/args.hh index 7f8ea647c909..401bebbabc08 100644 --- a/src/libutil/args.hh +++ b/src/libutil/args.hh @@ -81,15 +81,16 @@ public: FlagMaker & handler(std::function 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 + FlagMaker & dest(T * dest) { + flag->arity = 1; flag->handler = [=](Strings ss) { *dest = ss.front(); }; return *this; }; template FlagMaker & set(T * dest, const T & val) { - assert(flag->arity == 0); + flag->arity = 1; flag->handler = [=](Strings ss) { *dest = val; }; return *this; }; -- cgit 1.4.1