functions.zsh: actually declare funcs as funcs

This commit is contained in:
surtur 2023-09-08 14:29:46 +02:00
parent 7be15c66bc
commit 8d3b64e57e
Signed by: wanderer
SSH Key Fingerprint: SHA256:MdCZyJ2sHLltrLBp0xQO0O1qTW9BT/xl5nXkDvhlMCI

@ -1,16 +1,16 @@
transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi;tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } function transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi;tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; }
info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; } function info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; }
ix () { curl -n -F 'f:1=<-' http://ix.io 2>/dev/null ;} function ix () { curl -n -F 'f:1=<-' http://ix.io 2>/dev/null ;}
viman() { text=$(man "$@") && echo "$text" | vim -R +":set ft=man nomod nonu noma nolist colorcolumn=" - ; } function viman() { text=$(man "$@") && echo "$text" | vim -R +":set ft=man nomod nonu noma nolist colorcolumn=" - ; }
upload() { function upload() {
# inspired by https://www.alexander-pluhar.de/paste-file-host.html # inspired by https://www.alexander-pluhar.de/paste-file-host.html
# make eternity the default lifespan # make eternity the default lifespan
FILE_LIFESPAN=${2:-e} FILE_LIFESPAN=${2:-e}
@ -32,12 +32,12 @@ upload() {
} }
timesh() { function timesh() {
shell=${1:-$SHELL} shell=${1:-$SHELL}
for i in $(seq 1 10); do time $shell -i -c exit; done for i in $(seq 1 10); do time $shell -i -c exit; done
} }
timeplugins() { function timeplugins() {
for plugin ($plugins); do for plugin ($plugins); do
timer=$(($(date +%s%N)/1000000)) timer=$(($(date +%s%N)/1000000))
if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
@ -50,7 +50,7 @@ timeplugins() {
} }
delete-branches() { function delete-branches() {
git branch | git branch |
grep --invert-match '\*' | grep --invert-match '\*' |
cut -c 3- | cut -c 3- |
@ -58,7 +58,7 @@ delete-branches() {
xargs --no-run-if-empty git branch --delete --force xargs --no-run-if-empty git branch --delete --force
} }
fzf-open() { function fzf-open() {
local output local output
output=$(fzf </dev/tty) output=$(fzf </dev/tty)
if [ $output != "" ]; then if [ $output != "" ]; then