ZSH: Beginning of reconfiguring everything
This commit is contained in:
4
.config/zsh/autoload/dc
Executable file
4
.config/zsh/autoload/dc
Executable file
@@ -0,0 +1,4 @@
|
||||
function dc() {
|
||||
DOCKER_PARAMS="$@"
|
||||
find . -maxdepth 2 -type f -regextype posix-extended -regex '.*(docker-compose|compose)\.ya?ml' -execdir "docker compose ${DOCKER_PARAMS}" \;
|
||||
}
|
36
.config/zsh/autoload/extract
Executable file
36
.config/zsh/autoload/extract
Executable file
@@ -0,0 +1,36 @@
|
||||
function extract() {
|
||||
if [ -z "$1" ]; then
|
||||
# display usage if no parameters given
|
||||
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
|
||||
echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
|
||||
return 1
|
||||
else
|
||||
for n in $@; do
|
||||
if [ -f "$n" ]; then
|
||||
case "${n%,}" in
|
||||
*.tar.bz2 | *.tar.gz | *.tar.xz | *.tbz2 | *.tgz | *.txz | *.tar)
|
||||
tar xvf "$n"
|
||||
;;
|
||||
*.lzma) unlzma ./"$n" ;;
|
||||
*.bz2) bunzip2 ./"$n" ;;
|
||||
*.rar) unrar x -ad ./"$n" ;;
|
||||
*.gz) gunzip ./"$n" ;;
|
||||
*.zip) unzip ./"$n" ;;
|
||||
*.z) uncompress ./"$n" ;;
|
||||
*.7z | *.arj | *.cab | *.chm | *.deb | *.dmg | *.iso | *.lzh | *.msi | *.rpm | *.udf | *.wim | *.xar)
|
||||
7z x ./"$n"
|
||||
;;
|
||||
*.xz) unxz ./"$n" ;;
|
||||
*.exe) cabextract ./"$n" ;;
|
||||
*)
|
||||
echo "extract: '$n' - unknown archive method"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "'$n' - file does not exist"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
21
.config/zsh/autoload/zwcautocompile
Normal file
21
.config/zsh/autoload/zwcautocompile
Normal file
@@ -0,0 +1,21 @@
|
||||
## Automatically compile all compilable files to zwc
|
||||
|
||||
function zwcautocompile () {
|
||||
autoload -Uz zrecompile
|
||||
|
||||
for zsh_file in $(find ${ZDOTDIR} -type f -maxdepth 3 \( -name "*.zsh" -o -name ".zlogin" -o -name ".zshrc" \) ! -name "*.zwc" ! -name "*.zwc.old"); do
|
||||
zrecompile -pq $zsh_file && rm -f $zsh_file.zwc.old
|
||||
done
|
||||
|
||||
if [[ -d ${ZAUTOLOADDIR} ]]; then
|
||||
for f in ${ZAUTOLOADDIR}/*; do
|
||||
zrecompile -pq $f && rm -f $f.zwc.old
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ -d ${ZLIBDIR} ]]; then
|
||||
for f in ${ZLIBDIR}/*; do
|
||||
zrecompile -pq $f && rm -f $f.zwc.old
|
||||
done
|
||||
fi
|
||||
}
|
8
.config/zsh/autoload/zwcpurge
Normal file
8
.config/zsh/autoload/zwcpurge
Normal file
@@ -0,0 +1,8 @@
|
||||
## Purge all compiled zwc files
|
||||
|
||||
function zwcpurge () {
|
||||
autoload -Uz zrecompile
|
||||
for zsh_file in $(find ${ZDOTDIR} -maxdepth 3 -type f \( -name "*.zwc" -o -name "*.zwc.old" \)); do
|
||||
rm -f ${zsh_file}
|
||||
done
|
||||
}
|
Reference in New Issue
Block a user