From b27d8fd08b657e615ffa004fb46ccf9881ac108d Mon Sep 17 00:00:00 2001 From: Artem Sapegin Date: Thu, 15 Nov 2012 10:30:03 +0400 Subject: [PATCH] Bash: yay alias. --- includes/bash_functions.bash | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/includes/bash_functions.bash b/includes/bash_functions.bash index a4bf8df..fd11014 100644 --- a/includes/bash_functions.bash +++ b/includes/bash_functions.bash @@ -112,4 +112,20 @@ add-ssh-host() { _ssh_load_autocomplete() { complete -W "$(awk '/^\s*Host\s*/ { sub(/^\s*Host /, ""); print; }' ~/.ssh/config)" ssh } -_ssh_load_autocomplete \ No newline at end of file +_ssh_load_autocomplete + +# Upload current directory to special directory on my hosting +function yay() { + server="locum" + dir=`basename "$(pwd)"` + remote="~/projects/yay/$dir" + url="http://yay.sapegin.me/$dir/" + + tar cp --exclude '.git' . | gzip | ssh $server "mkdir -p "$remote"; gzip -cd | tar x -C "$remote"" + + echo "Current directory uploaded to $url." + if command -v pbcopy >/dev/null 2>&1; then + echo -n "$url" | pbcopy + echo "URL copied to clipboard." + fi +} \ No newline at end of file