From c60e26e55b565809862b90803a60f413ba7a9fdb Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 24 Oct 2023 00:43:49 +0200 Subject: list-observations: Allow substring match in --taxon. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Useful for `--taxon=ticka,blÄslav,spindling` for instance. --- list-observations | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/list-observations b/list-observations index 0a9764c..91aeeec 100755 --- a/list-observations +++ b/list-observations @@ -213,9 +213,11 @@ while feature is not None: vernacularName = getField(feature, 'VernacularName') if vernacularName is None: raise Exception('Missing name') - if args.taxon is not None and vernacularName.lower() not in args.taxon: - feature = layer.GetNextFeature() - continue + if args.taxon is not None: + name = vernacularName.lower() + if not any([sub in name for sub in args.taxon]): + feature = layer.GetNextFeature() + continue protectedByLaw = feature.GetField('ProtectedByLaw') if args.protected and (protectedByLaw is None or not protectedByLaw): -- cgit v1.2.3