clipboard option

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2021-10-06 13:40:45 +03:00
parent 8aea6446bb
commit cd5f695936
1 changed files with 8 additions and 1 deletions

9
ufw
View File

@ -43,6 +43,7 @@ usage() {
-t|--tags "<tag1[, tag2,..]>" # 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;;