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
|
||||
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)
|
||||
# Move it to a random name without clobbering, this prevents things like
|
||||
# files/files
|
||||
# From erroring because you can't move files/files to .
|
||||
chronic mv -n "$1" "$name" || return 5
|
||||
chronic mv "$name"/*(D) .
|
||||
chronic rmdir -v "$name"
|
||||
# Move the directory to the uuid
|
||||
=mv -n "$1" "$name" || return 1
|
||||
# Move all files, use (N) in case there is no * or .* matches
|
||||
=mv -n "$name"/{.,}*(N) . || return 2
|
||||
=rmdir "$name" || return 3
|
||||
}
|
||||
alias afci='git x ./autoformat.sh;git add --all;git commit -m "Autoformatted"'
|
||||
alias eix="eix -F"
|
||||
|
Loading…
Reference in New Issue
Block a user