xclip selector selector :>

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2021-10-06 13:49:35 +03:00
parent cd5f695936
commit 3f094a2b47

12
ufw
View File

@ -171,7 +171,7 @@ upload() {
(( flag_directlink )) || file_link="${file_link#*.}"
}
(( flag_clipboard )) && xclip <<< "$file_link"
(( flag_clipboard )) && xclip "${xclip_args[@]}" <<< "$file_link"
printf '%s\n' "$file_link"
@ -196,7 +196,7 @@ get_shortlink() {
jq -r '.data.short_url' <<< "$api_response"
)
(( flag_clipboard )) && xclip <<< "$short_url"
(( flag_clipboard )) && xclip "${xclip_args[@]}" <<< "$short_url"
printf '%s\n' "$short_url"
else
printf 'Error: %s %s\n' "$api_status" "$api_status_message"
@ -237,7 +237,7 @@ get_my_ip() {
if (( api_status == 200 )); then
my_ip=$( jq -r '.data.ip' <<< "$api_response" )
(( flag_clipboard )) && xclip <<< "$my_ip"
(( flag_clipboard )) && xclip "${xclip_args[@]}" <<< "$my_ip"
printf '%s\n' "$my_ip"
else
printf 'Error: %s %s\n' "$api_status" "$api_status_message"
@ -363,6 +363,7 @@ main() {
: ${flag_shortlink:=0}
: ${flag_directlink:=1}
: ${flag_clipboard:=0}
: ${xclip_selector:='clipboard'}
while [[ "$1" ]]; do
case "$1" in
@ -384,7 +385,10 @@ main() {
(-P|--page-url) flag_directlink=0;;
(-q|--quiet) flag_quiet=1;;
(-v|--void) flag_void=1;;
# Clipboard
(-c|--clipboard) flag_clipboard=1;;
(-C|--xclip-selector) xclip_selector=$2; shift;;
(--notify) flag_notify=1;;
(--no-notify|-n) flag_notify=0;;
@ -412,6 +416,8 @@ main() {
shift
done
xclip_args+=( -selection "$xclip_selector" )
# Catch the args after --
if (( $# )); then
args+=( "$@" )