fish: update ghq_rm function to use the new 'rm' subcommand of ghq

Present in ghq v1.5.0
This commit is contained in:
Hoang Nguyen 2024-02-03 00:00:00 +07:00
parent a1a400a765
commit ac32f4d838
Signed by: folliehiyuki
GPG Key ID: B0567C20730E9B11
1 changed files with 3 additions and 11 deletions

View File

@ -1,18 +1,10 @@
function ghq_rm
set -l projects (ghq list --exact | fzf \
--multi \
--prompt "Project: " \
--preview 'lsd -1FAL --group-dirs first --icon always --color always {}' \
)
set -l projects (ghq list --exact | fzf --multi --prompt "Project: ")
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
set -l proj_dir (ghq list --full-path "$proj")
ghq rm "$proj"; and rmdir -p --ignore-fail-on-non-empty (dirname "$proj_dir")
end
end
end