dotfiles-ansible/roles/config/files/fish/ghq_rm.fish

19 lines
526 B
Fish

function ghq_rm
set -l projects (ghq list --exact | fzf \
--multi \
--prompt "Project: " \
--preview 'lsd -1FAL --group-dirs first --icon always --color always {}' \
)
if test -n "$projects"
for proj in $projects
read -l -P (printf "Delete project \033[1;33m$proj\033[0m? [y/N]") confirm
if test "$confirm" = "y"
set -l proj_dir (ghq list --full-path "$proj")
rm -rf "$proj_dir"
rmdir -p --ignore-fail-on-non-empty (dirname "$proj_dir")
end
end
end
end