Skip to content

Commit

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

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

refs #40
  • Loading branch information
drebs committed Aug 23, 2024
1 parent 65227fa commit ee930db
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 ee930db

Please sign in to comment.