Bash: yay alias.

This commit is contained in:
Artem Sapegin 2012-11-15 10:30:03 +04:00
parent e02d22d3d3
commit b27d8fd08b

View File

@ -112,4 +112,20 @@ add-ssh-host() {
_ssh_load_autocomplete() { _ssh_load_autocomplete() {
complete -W "$(awk '/^\s*Host\s*/ { sub(/^\s*Host /, ""); print; }' ~/.ssh/config)" ssh complete -W "$(awk '/^\s*Host\s*/ { sub(/^\s*Host /, ""); print; }' ~/.ssh/config)" ssh
} }
_ssh_load_autocomplete _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
}