aiee

Python modules for common command line interfacing utils
git clone git://git.defalsify.org/aiee.git
Log | Files | Refs | LICENSE

commit d79592754e362cad0675867ecc983b924eccdd0d
parent 933a15d494b1eae11eb568469100f60cba07555e
Author: lash <dev@holbrook.no>
Date:   Wed, 11 May 2022 18:36:47 +0000

Add negate on arg match

Diffstat:
Maiee/arg.py | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/aiee/arg.py b/aiee/arg.py @@ -190,12 +190,15 @@ class Arg: return self.__flags.get(k) - def match(self, k, v_cmp): + def match(self, k, v_cmp, negate=False): k = to_key(k) v = self.__flags.val(k) if v == 0: return False - return (v & self.__z & v_cmp) == v + r = 0 + if not negate: + r = (v & self.__z & v_cmp) + return r == v def __iter__(self):