clipboard option
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
8aea6446bb
commit
cd5f695936
9
ufw
9
ufw
|
@ -43,6 +43,7 @@ usage() {
|
||||||
-t|--tags "<tag1[, tag2,..]>" # Add tags to the file.
|
-t|--tags "<tag1[, tag2,..]>" # Add tags to the file.
|
||||||
-q|--quiet # Be quiet.
|
-q|--quiet # Be quiet.
|
||||||
-v|--void # Don't add the file to my files.
|
-v|--void # Don't add the file to my files.
|
||||||
|
-c|--clipboard # Throw the result into the clipboard
|
||||||
|
|
||||||
Config options (~/.config/ufw):
|
Config options (~/.config/ufw):
|
||||||
secret # Your personal token. Get it at https://zfh.so/settings_form
|
secret # Your personal token. Get it at https://zfh.so/settings_form
|
||||||
|
@ -170,6 +171,8 @@ upload() {
|
||||||
(( flag_directlink )) || file_link="${file_link#*.}"
|
(( flag_directlink )) || file_link="${file_link#*.}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(( flag_clipboard )) && xclip <<< "$file_link"
|
||||||
|
|
||||||
printf '%s\n' "$file_link"
|
printf '%s\n' "$file_link"
|
||||||
|
|
||||||
if (( flag_rm )); then
|
if (( flag_rm )); then
|
||||||
|
@ -192,7 +195,8 @@ get_shortlink() {
|
||||||
read -r short_url real_url < <(
|
read -r short_url real_url < <(
|
||||||
jq -r '.data.short_url' <<< "$api_response"
|
jq -r '.data.short_url' <<< "$api_response"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(( flag_clipboard )) && xclip <<< "$short_url"
|
||||||
printf '%s\n' "$short_url"
|
printf '%s\n' "$short_url"
|
||||||
else
|
else
|
||||||
printf 'Error: %s %s\n' "$api_status" "$api_status_message"
|
printf 'Error: %s %s\n' "$api_status" "$api_status_message"
|
||||||
|
@ -233,6 +237,7 @@ get_my_ip() {
|
||||||
|
|
||||||
if (( api_status == 200 )); then
|
if (( api_status == 200 )); then
|
||||||
my_ip=$( jq -r '.data.ip' <<< "$api_response" )
|
my_ip=$( jq -r '.data.ip' <<< "$api_response" )
|
||||||
|
(( flag_clipboard )) && xclip <<< "$my_ip"
|
||||||
printf '%s\n' "$my_ip"
|
printf '%s\n' "$my_ip"
|
||||||
else
|
else
|
||||||
printf 'Error: %s %s\n' "$api_status" "$api_status_message"
|
printf 'Error: %s %s\n' "$api_status" "$api_status_message"
|
||||||
|
@ -357,6 +362,7 @@ main() {
|
||||||
: ${cfg_max_filesize:='200M'}
|
: ${cfg_max_filesize:='200M'}
|
||||||
: ${flag_shortlink:=0}
|
: ${flag_shortlink:=0}
|
||||||
: ${flag_directlink:=1}
|
: ${flag_directlink:=1}
|
||||||
|
: ${flag_clipboard:=0}
|
||||||
|
|
||||||
while [[ "$1" ]]; do
|
while [[ "$1" ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -378,6 +384,7 @@ main() {
|
||||||
(-P|--page-url) flag_directlink=0;;
|
(-P|--page-url) flag_directlink=0;;
|
||||||
(-q|--quiet) flag_quiet=1;;
|
(-q|--quiet) flag_quiet=1;;
|
||||||
(-v|--void) flag_void=1;;
|
(-v|--void) flag_void=1;;
|
||||||
|
(-c|--clipboard) flag_clipboard=1;;
|
||||||
|
|
||||||
(--notify) flag_notify=1;;
|
(--notify) flag_notify=1;;
|
||||||
(--no-notify|-n) flag_notify=0;;
|
(--no-notify|-n) flag_notify=0;;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user