Hi,

Args::read_or_set does not work for me (actually it is not used anywhere), the default is not set when the argument is not given and parsing fails. Seems like _read_status should be set before going into postparse (see attached patch) ?

Regards, Björn





>From 0b7fa5fa2698d6c19b97a9263781cbd07aa283ad Mon Sep 17 00:00:00 2001
From: Bjorn Lichtblau <[email protected]>
Date: Thu, 10 Jan 2013 23:47:10 +0100
Subject: [PATCH] FIX: Args' read_or_set

---
 include/click/args.hh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/click/args.hh b/include/click/args.hh
index dd3174e..d0c2621 100644
--- a/include/click/args.hh
+++ b/include/click/args.hh
@@ -624,7 +624,7 @@ class Args : public ArgContext {
 	Slot *slot_status;
 	String str = find(keyword, flags, slot_status);
 	T *s = slot(variable);
-	postparse(s && (str ? DefaultArg<T>().parse(str, *s, *this) : (*s = value, true)), slot_status);
+	postparse(s && (str ? DefaultArg<T>().parse(str, *s, *this) : (*s = value, _read_status = true, true)), slot_status);
     }
 
     template<typename P, typename T>
-- 
1.7.10.4



_______________________________________________
click mailing list
[email protected]
https://amsterdam.lcs.mit.edu/mailman/listinfo/click

Reply via email to