mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2025-06-29 12:10:42 +00:00
Update dotfiles
This commit is contained in:
parent
0a7d4c700d
commit
6e2557cc86
6 changed files with 326 additions and 182 deletions
24
home/.config/sh/handlers
Executable file
24
home/.config/sh/handlers
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Command not found hook that uses `pkgfile` package
|
||||
# to search through the package database in order to
|
||||
# find a package which includes given command, which
|
||||
# was resolved as not found, if there are no such packages
|
||||
# only print command not found message
|
||||
command_not_found_handler() {
|
||||
local pkgs cmd="$1" files=()
|
||||
printf 'zsh: command not found: %s' "$cmd" # print command not found asap, then search for packages
|
||||
files=(${(f)"$(pkgfile ${cmd})"})
|
||||
if (( ${#files[@]} )); then
|
||||
printf '\r%s may be found in the following packages:\n' "$cmd"
|
||||
local res=() repo package version file
|
||||
for file in "$files[@]"; do
|
||||
res=("${(0)file}")
|
||||
repo="$res[1]"
|
||||
printf ' %s\n' "$repo"
|
||||
done
|
||||
else
|
||||
printf '\n'
|
||||
fi
|
||||
return 127
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue