This commit is contained in:
2024-10-18 22:19:09 +02:00
parent a850f644de
commit ece099b6a4
11 changed files with 1056 additions and 229 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
trap clean_up EXIT
_STTY=$(stty -g) ## Save current terminal setup
@@ -52,7 +52,7 @@ function decode() {
# <sequence> ST, and for all ESCs in <sequence> to be replaced with ESC ESC. It
# only accepts ESC backslash for ST.
function print_osc() {
if [[ $TERM == screen* ]] ; then
if [[ $TERM == screen* || $TERM == tmux* ]] ; then
printf "\033Ptmux;\033\033]"
else
printf "\033]"
@@ -61,16 +61,25 @@ function print_osc() {
# More of the tmux workaround described above.
function print_st() {
if [[ $TERM == screen* ]] ; then
if [[ $TERM == screen* || $TERM == tmux* ]] ; then
printf "\a\033\\"
else
printf "\a"
fi
}
function b64_encode() {
if [[ "$IT2DL_BASE64_VERSION" =~ GNU ]]; then
# Disable line wrap
base64 -w0
else
base64
fi
}
function send_request_for_upload() {
print_osc
printf '1337;RequestUpload=format=tgz' ""
printf '1337;RequestUpload=format=tgz;version=%s' "$(tar --version | head -1 | b64_encode)"
print_st
}