From cd5f6959365a68287a62718246522904236cbceb Mon Sep 17 00:00:00 2001 From: fbt Date: Wed, 6 Oct 2021 13:40:45 +0300 Subject: [PATCH] clipboard option Signed-off-by: fbt --- ufw | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ufw b/ufw index f3dc024..a54aa55 100755 --- a/ufw +++ b/ufw @@ -43,6 +43,7 @@ usage() { -t|--tags "" # Add tags to the file. -q|--quiet # Be quiet. -v|--void # Don't add the file to my files. + -c|--clipboard # Throw the result into the clipboard Config options (~/.config/ufw): secret # Your personal token. Get it at https://zfh.so/settings_form @@ -170,6 +171,8 @@ upload() { (( flag_directlink )) || file_link="${file_link#*.}" } + (( flag_clipboard )) && xclip <<< "$file_link" + printf '%s\n' "$file_link" if (( flag_rm )); then @@ -192,7 +195,8 @@ get_shortlink() { read -r short_url real_url < <( jq -r '.data.short_url' <<< "$api_response" ) - + + (( flag_clipboard )) && xclip <<< "$short_url" printf '%s\n' "$short_url" else printf 'Error: %s %s\n' "$api_status" "$api_status_message" @@ -233,6 +237,7 @@ get_my_ip() { if (( api_status == 200 )); then my_ip=$( jq -r '.data.ip' <<< "$api_response" ) + (( flag_clipboard )) && xclip <<< "$my_ip" printf '%s\n' "$my_ip" else printf 'Error: %s %s\n' "$api_status" "$api_status_message" @@ -357,6 +362,7 @@ main() { : ${cfg_max_filesize:='200M'} : ${flag_shortlink:=0} : ${flag_directlink:=1} + : ${flag_clipboard:=0} while [[ "$1" ]]; do case "$1" in @@ -378,6 +384,7 @@ main() { (-P|--page-url) flag_directlink=0;; (-q|--quiet) flag_quiet=1;; (-v|--void) flag_void=1;; + (-c|--clipboard) flag_clipboard=1;; (--notify) flag_notify=1;; (--no-notify|-n) flag_notify=0;;