Great changes in dedir
This commit is contained in:
parent
2d44e18fe7
commit
b33680e04a
17
shells/zshrc
17
shells/zshrc
@ -56,14 +56,17 @@ dsl() {
|
|||||||
}
|
}
|
||||||
# Remove directory by removing subdirectories up a level
|
# Remove directory by removing subdirectories up a level
|
||||||
dedir(){
|
dedir(){
|
||||||
chronic rmdir "$1" -v && return
|
# Try removing the directory if it's empty, fail silently if you can't
|
||||||
|
=rmdir "$1" 2>/dev/null && return
|
||||||
|
# Make a uuid to avoid name conflicts
|
||||||
|
# Ex: dediring sage when sage/sage fails because sage/sage is moved to .
|
||||||
|
# but since sage/ exists, it can't be moved
|
||||||
name=$(uuidgen)
|
name=$(uuidgen)
|
||||||
# Move it to a random name without clobbering, this prevents things like
|
# Move the directory to the uuid
|
||||||
# files/files
|
=mv -n "$1" "$name" || return 1
|
||||||
# From erroring because you can't move files/files to .
|
# Move all files, use (N) in case there is no * or .* matches
|
||||||
chronic mv -n "$1" "$name" || return 5
|
=mv -n "$name"/{.,}*(N) . || return 2
|
||||||
chronic mv "$name"/*(D) .
|
=rmdir "$name" || return 3
|
||||||
chronic rmdir -v "$name"
|
|
||||||
}
|
}
|
||||||
alias afci='git x ./autoformat.sh;git add --all;git commit -m "Autoformatted"'
|
alias afci='git x ./autoformat.sh;git add --all;git commit -m "Autoformatted"'
|
||||||
alias eix="eix -F"
|
alias eix="eix -F"
|
||||||
|
Loading…
Reference in New Issue
Block a user