Skip to content

Commit

Permalink
valid x-url-delete getter | reorganize log output
Browse files Browse the repository at this point in the history
  • Loading branch information
RajaRakoto committed Sep 21, 2022
1 parent 9b4a7f0 commit e0e346c
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions transfer-cli
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ example="\n\ttransfer-cli --upload-gpg file.txt\n
\ttransfer-cli --clear
"

### TODO: done
function transfer-banner() {
akory -d .005 " _ __ _ _ "
akory -d .005 "| |_ _ __ __ _ _ __ ___ / _| ___ _ __ ___| (_)"
akory -d .005 "| __| '__/ _ | '_ \/ __| |_ / _ \ '__|____ / __| | |"
akory -d .005 "| |_| | | (_| | | | \__ \ _| __/ | |_____| (__| | |"
akory -d .005 " \__|_| \__,_|_| |_|___/_| \___|_| \___|_|_|"
echo ''
akory -d .02 "Version: $version"
akory -d .02 "Author: $author"
}

### TODO: done
function try() {
[[ $- = *e* ]]
Expand All @@ -34,18 +46,6 @@ function throwErrors() {
set -e
}

### TODO: done
function transfer-banner() {
akory -d .005 " _ __ _ _ "
akory -d .005 "| |_ _ __ __ _ _ __ ___ / _| ___ _ __ ___| (_)"
akory -d .005 "| __| '__/ _ | '_ \/ __| |_ / _ \ '__|____ / __| | |"
akory -d .005 "| |_| | | (_| | | | \__ \ _| __/ | |_____| (__| | |"
akory -d .005 " \__|_| \__,_|_| |_|___/_| \___|_| \___|_|_|"
echo ''
akory -d .02 "Version: $version"
akory -d .02 "Author: $author"
}

### TODO: done
function transfer-list() {
cat ~/.transfer.log
Expand Down Expand Up @@ -80,9 +80,15 @@ function transfer-upload-gpg() {
(
throwErrors
cat "$2" | gpg -ac -o- | curl -v --progress-bar -X PUT --upload-file "-" https://transfer.sh/"$2" >~/.transfer.tmp
date=$(date '+%Y-%m-%d|%H:%M:%S')
date=$(date '+%Y-%m-%d | %H:%M:%S')
read -p "File description: " file_description
echo "[$date][$file_description] -> $(head ~/.transfer.tmp)" >>~/.transfer.log
read -p "Paste the 'x-url-delete' value above: " delete_token
echo -e "\n=====================================================================" >>~/.transfer.log
echo "[URL] -> $(head ~/.transfer.tmp)" >>~/.transfer.log
echo "[DATE] -> $date" >>~/.transfer.log
echo "[DESCRIPTION] -> $file_description" >>~/.transfer.log
echo "[X-URL-DELETE] -> $delete_token" >>~/.transfer.log
echo -e "=====================================================================" >>~/.transfer.log
rm ~/.transfer.tmp
transfer-list
akory -d .02 'File uploaded ... [done]'
Expand Down Expand Up @@ -111,7 +117,7 @@ function transfer-download-gpg() {
try
(
throwErrors
curl --progress-bar "$2" | gpg -o- >"$3"
curl -v --progress-bar "$2" | gpg -o- >"$3"
akory -d .02 'File downloaded ... [done]'
)
catch || {
Expand Down

0 comments on commit e0e346c

Please sign in to comment.