From 8971a3915e612dcb2592c39338b51b09d40f7016 Mon Sep 17 00:00:00 2001 From: Sean Breckenridge Date: Tue, 21 Feb 2023 16:11:39 -0800 Subject: [PATCH] fatally erro if pyfzf not installed --- my/core/denylist.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/my/core/denylist.py b/my/core/denylist.py index 66a4906..4cf960d 100644 --- a/my/core/denylist.py +++ b/my/core/denylist.py @@ -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: - from pyfzf import FzfPrompt + 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