diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2012-06-16 20:36:37 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-06-16 20:36:37 +0100 |
commit | f1d3229e4fe5e1762ab9a51e3739d047276f350c (patch) | |
tree | 4bf139ff6c0c89d029677c5ba86a5b68cc9f7556 /alot | |
parent | 562c4deb82c61747164e535b871e57ef7e6dd11d (diff) |
fix BooleanAction
apparently the __call__ method got lost on the way.
Moreover the choices list must match the target type,
so is useless here
Diffstat (limited to 'alot')
-rw-r--r-- | alot/utils/booleanaction.py | 8 |
1 files 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) |