diff options
author | Daniel Thompson <daniel.thompson@linaro.org> | 2018-02-28 21:15:57 +0000 |
---|---|---|
committer | Daniel Thompson <daniel.thompson@linaro.org> | 2018-02-28 21:15:57 +0000 |
commit | 5bb8e203791e0acac6aea81a51c8919e3c76fa7c (patch) | |
tree | f116eb4d6537e6dca59e06f2871e8ac462e9149c | |
parent | bcccb7c91782f0d4ba9816b48de6210cfbaa6f92 (diff) |
96btool: filter: comma seperated categories
-rwxr-xr-x | bin/96btool | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/96btool b/bin/96btool index 47d6b98..d8c70fd 100755 --- a/bin/96btool +++ b/bin/96btool @@ -362,8 +362,16 @@ def do_filter(args): posts = [ p for p in posts if is_first_post(p) ] if args.category: - posts = [ p for p in posts if args.category.lower() in - p['topic']['category'].lower() ] + categories = args.category.lower().split(',') + def matched(p): + category = p['topic']['category'].lower() + for c in categories: + if c in category: + return True + + return False + + posts = [ p for p in posts if matched(p) ] if args.grep: e = re.compile(args.grep) |