mirror of
https://github.com/wfxr/forgit.git
synced 2026-09-10 07:16:23 -04:00
add gclean
This commit is contained in:
parent
24a38b00f3
commit
4eefa62936
|
|
@ -121,6 +121,16 @@ __forgit_restore() {
|
|||
echo 'Nothing to restore.'
|
||||
}
|
||||
|
||||
__forgit_clean() {
|
||||
if [[ __forgit_inside_work_tree -ne 0 ]]; then
|
||||
return 1
|
||||
fi
|
||||
# Note: Postfix '/' in directory path should be removed. Otherwise the directory itself will not be removed.
|
||||
local files=$(git clean -xdfn "$@"| awk '{print $3}'| __forgit_fzf -m -0 |sed 's#/$##')
|
||||
[[ -n "$files" ]] && echo "$files" |xargs -I{} git clean -xdf {} && return
|
||||
echo 'Nothing to clean.'
|
||||
}
|
||||
|
||||
# git ignore generator
|
||||
export FORGIT_GI_CACHE=~/.gicache
|
||||
export FORGIT_GI_INDEX=${FORGIT_GI_CACHE}/.index
|
||||
|
|
@ -169,3 +179,4 @@ alias ${forgit_log:-glo}=__forgit_log
|
|||
alias ${forgit_diff:-gd}=__forgit_diff
|
||||
alias ${forgit_ignore:-gi}=__forgit_ignore
|
||||
alias ${forgit_restore:-gcf}=__forgit_restore
|
||||
alias ${forgit_clean:-gclean}=__forgit_clean
|
||||
|
|
|
|||
Loading…
Reference in a new issue