Skip to content

Commit

Permalink
Fix the --enable-filters option
Browse files Browse the repository at this point in the history
Filter objects must be initialized with the options found in the config file
but, in the case of `--enable-filters`, new objects were being initialized with
config options ignored.

This change makes use of the `configured_filter_chain` list of
already-initialized filter objects and trims it down by comparing filter class
names with the values passed in the command line for `--enable-filters`.

Closes: #40
  • Loading branch information
drebs committed Aug 27, 2024
1 parent 65227fa commit 841b78e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions afew/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,12 @@ def main():
sys.exit('Unknown filter(s) selected: %s' % (' '.join(
enabled_filters_set.difference(all_filters_set))))

args.enable_filters = [all_filters[filter_name](database)
for filter_name
in args.enable_filters]
enabled_classes = [all_filters[filter_name]
for filter_name
in args.enable_filters]
args.enable_filters = [i for i in
filter(lambda f: f.__class__ in enabled_classes,
configured_filter_chain)]
else:
args.enable_filters = configured_filter_chain

Expand Down

0 comments on commit 841b78e

Please sign in to comment.