1
0
Fork 0
mirror of https://gitlab.com/mlunax/dotfiles.git synced 2025-04-12 05:40:17 +00:00

add atransfer func

This commit is contained in:
Luna 2025-01-27 14:44:01 +01:00
parent cfee7d7b5e
commit 992b1064cc

26
.zshrc
View file

@ -206,6 +206,32 @@ if iscmd go; then
export GOPATH=$HOME/.local/go
fi
function atransfer ()
{
if [ $# -eq 0 ]; then
echo "No arguments specified.\nUsage:\n transfer <file|directory>\n ... | transfer <file_name>" 1>&2;
return 1;
fi;
if tty -s; then
file="$1";
file_name=$(basename "$file");
if [ ! -e "$file" ]; then
echo "$file: No such file or directory" 1>&2;
return 1;
fi;
if [ -d "$file" ]; then
file_name="$file_name.zip" ,;
( cd "$file" && zip -r -q - . ) | curl --progress-bar --upload-file "-" "https://transfer.archivete.am/$file_name" | tee /dev/null,;
else
cat "$file" | curl --progress-bar --upload-file "-" "https://transfer.archivete.am/$file_name" | tee /dev/null;
fi;
else
file_name=$1;
curl --progress-bar --upload-file "-" "https://transfer.archivete.am/$file_name" | tee /dev/null;
fi
}
DISABLE_MAGIC_FUNCTIONS=true
source $OTHER/func.zsh
source "$plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"