about summary refs log tree commit diff
path: root/src/libutil/args.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-09-14T11·22+0200
committerEelco Dolstra <edolstra@gmail.com>2017-09-14T11·29+0200
commit970366266b8df712f5f9cedb45af183ef5a8357f (patch)
treeef67f46d59adedf993730d06780efa7ea597e3cd /src/libutil/args.hh
parent1c58ad2ffa698d17b7be56eab69a40ace64d0e21 (diff)
Add "nix add-to-store" command
Diffstat (limited to 'src/libutil/args.hh')
-rw-r--r--src/libutil/args.hh7
1 files changed, 4 insertions, 3 deletions
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<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;
         };