diff options
author | tdro <tdro@users.noreply.github.com> | 2021-11-20 23:03:06 -0500 |
---|---|---|
committer | tdro <tdro@users.noreply.github.com> | 2021-11-20 23:11:18 -0500 |
commit | 3a733d76f1155a04461e31e7ff6270256f6a335a (patch) | |
tree | c2f90500f87cd9193b4ba59fbbecd1071aa84de8 | |
parent | 2eb824499ed7b4d76b29e5068c0d4e0c2f83adaa (diff) | |
download | dotfiles-3a733d76f1155a04461e31e7ff6270256f6a335a.tar.gz dotfiles-3a733d76f1155a04461e31e7ff6270256f6a335a.tar.bz2 dotfiles-3a733d76f1155a04461e31e7ff6270256f6a335a.zip |
.local/bin/,: Bail when nothing found
Allow no-group and regex.
-rwxr-xr-x | .local/bin/, | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/.local/bin/, b/.local/bin/, index 58ed5ef..47b2673 100755 --- a/.local/bin/, +++ b/.local/bin/, @@ -33,11 +33,14 @@ nix-index --nixpkgs https://github.com/NixOS/nixpkgs/archive/master.tar.gz { [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ] || [ "$#" = 0 ]; } && help && exit databasePath=${XDG_DATA_HOME:-~/.cache}/nix-index -nixLocate='nix-locate --db '"$databasePath"' -- '"${1:-}" +nixLocate='nix-locate --db '"$databasePath"' --no-group --regex -- '"${1:-}" attributes=$($nixLocate | awk '{ print $1, $4 }' | sed 's|/nix/store/.[^-]*-||g') + +[ -z "$attributes" ] && printf "No files found containing '%s'\n" "${1:-}" && exit + attribute=$(printf '%s' "$attributes" | column --table | fzf | awk '{ print $1 }') -[ -z "$attribute" ] && exit +[ -z "$attribute" ] && exit printf '\nsetting up shell with %s path...\n' "$attribute" |