Add check for locate binary on system

This commit is contained in:
Eric Torres 2023-01-17 15:46:41 -08:00
parent a22774da5f
commit eb701afcd3

View File

@ -56,7 +56,12 @@ parser.add_argument("patterns", nargs="+", help="file pattern to search for")
args = parser.parse_args()
files = locate_files(args.patterns)
selected_file = run_fzf(files)
try:
files = locate_files(args.patterns)
# Locate binary is optional for package, but required for script
except FileNotFoundError:
print("locate binary not found, install and re-run script")
else:
selected_file = run_fzf(files)
subprocess.run([PACMAN_CMD, "-Qo", selected_file])