fatally erro if pyfzf not installed

This commit is contained in:
Sean Breckenridge 2023-02-21 16:11:39 -08:00
parent 90f7dd2ac8
commit 8971a3915e

View file

@ -102,6 +102,7 @@ or `my.location.all` from other modules and get the filtered results, without
having to mix data filtering logic with parsing/loading/caching (the stuff HPI does)
"""
import sys
import json
import functools
from collections import defaultdict
@ -236,7 +237,11 @@ class DenyList:
yield key
def deny_cli(self, itr: Iterator[T]) -> None:
try:
from pyfzf import FzfPrompt
except ImportError:
click.echo("pyfzf is required to use the denylist cli, run 'python3 -m pip install pyfzf_iter'", err=True)
sys.exit(1)
# wrap in seekable so we can use it multiple times
# progressively caches the items as we iterate over them