From f1d3229e4fe5e1762ab9a51e3739d047276f350c Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Sat, 16 Jun 2012 20:36:37 +0100 Subject: fix BooleanAction apparently the __call__ method got lost on the way. Moreover the choices list must match the target type, so is useless here --- alot/utils/booleanaction.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/alot/utils/booleanaction.py b/alot/utils/booleanaction.py index 7bc81bb7..30901e08 100644 --- a/alot/utils/booleanaction.py +++ b/alot/utils/booleanaction.py @@ -5,8 +5,8 @@ import argparse import re -TRUEISH = ['1', 't', 'true', 'yes', 'on'] -FALSISH = ['0', 'f', 'false', 'no', 'off'] +TRUEISH = ['true', 'yes', 'on', '1', 't', 'y'] +FALSISH = ['false', 'no', 'off', '0', 'f', 'n'] def boolean(string): @@ -25,6 +25,8 @@ class BooleanAction(argparse.Action): """ def __init__(self, *args, **kwargs): kwargs['type'] = boolean - kwargs['choices'] = TRUEISH + FALSISH kwargs['metavar'] = 'BOOL' argparse.Action.__init__(self, *args, **kwargs) + + def __call__(self, parser, namespace, values, option_string=None): + setattr(namespace, self.dest, values) -- cgit v1.2.3