From dff440aab32131b3459cadc2c4cc60c6f42674c6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 6 Sep 2017 16:20:34 +0200 Subject: nix build: Add --out-link and --no-link options --- src/libutil/args.hh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/libutil') diff --git a/src/libutil/args.hh b/src/libutil/args.hh index 044ed209e3bf..7f8ea647c909 100644 --- a/src/libutil/args.hh +++ b/src/libutil/args.hh @@ -80,6 +80,19 @@ public: FlagMaker & arity(size_t arity) { flag->arity = arity; return *this; }; 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); + flag->handler = [=](Strings ss) { *dest = ss.front(); }; + return *this; + }; + + template + FlagMaker & set(T * dest, const T & val) { + assert(flag->arity == 0); + flag->handler = [=](Strings ss) { *dest = val; }; + return *this; + }; }; FlagMaker mkFlag(); -- cgit 1.4.1