mirror of
https://gitlab.com/mlunax/dotfiles.git
synced 2025-04-19 08:45:36 +00:00
add atransfer func
This commit is contained in:
parent
cfee7d7b5e
commit
992b1064cc
1 changed files with 26 additions and 0 deletions
26
.zshrc
26
.zshrc
|
@ -206,6 +206,32 @@ if iscmd go; then
|
||||||
export GOPATH=$HOME/.local/go
|
export GOPATH=$HOME/.local/go
|
||||||
fi
|
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
|
DISABLE_MAGIC_FUNCTIONS=true
|
||||||
source $OTHER/func.zsh
|
source $OTHER/func.zsh
|
||||||
source "$plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"
|
source "$plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"
|
||||||
|
|
Loading…
Add table
Reference in a new issue