xclip selector selector :>
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
cd5f695936
commit
3f094a2b47
12
ufw
12
ufw
|
@ -171,7 +171,7 @@ upload() {
|
||||||
(( flag_directlink )) || file_link="${file_link#*.}"
|
(( flag_directlink )) || file_link="${file_link#*.}"
|
||||||
}
|
}
|
||||||
|
|
||||||
(( flag_clipboard )) && xclip <<< "$file_link"
|
(( flag_clipboard )) && xclip "${xclip_args[@]}" <<< "$file_link"
|
||||||
|
|
||||||
printf '%s\n' "$file_link"
|
printf '%s\n' "$file_link"
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ get_shortlink() {
|
||||||
jq -r '.data.short_url' <<< "$api_response"
|
jq -r '.data.short_url' <<< "$api_response"
|
||||||
)
|
)
|
||||||
|
|
||||||
(( flag_clipboard )) && xclip <<< "$short_url"
|
(( flag_clipboard )) && xclip "${xclip_args[@]}" <<< "$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"
|
||||||
|
@ -237,7 +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"
|
(( flag_clipboard )) && xclip "${xclip_args[@]}" <<< "$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"
|
||||||
|
@ -363,6 +363,7 @@ main() {
|
||||||
: ${flag_shortlink:=0}
|
: ${flag_shortlink:=0}
|
||||||
: ${flag_directlink:=1}
|
: ${flag_directlink:=1}
|
||||||
: ${flag_clipboard:=0}
|
: ${flag_clipboard:=0}
|
||||||
|
: ${xclip_selector:='clipboard'}
|
||||||
|
|
||||||
while [[ "$1" ]]; do
|
while [[ "$1" ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -384,7 +385,10 @@ 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;;
|
||||||
|
|
||||||
|
# Clipboard
|
||||||
(-c|--clipboard) flag_clipboard=1;;
|
(-c|--clipboard) flag_clipboard=1;;
|
||||||
|
(-C|--xclip-selector) xclip_selector=$2; shift;;
|
||||||
|
|
||||||
(--notify) flag_notify=1;;
|
(--notify) flag_notify=1;;
|
||||||
(--no-notify|-n) flag_notify=0;;
|
(--no-notify|-n) flag_notify=0;;
|
||||||
|
@ -412,6 +416,8 @@ main() {
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
xclip_args+=( -selection "$xclip_selector" )
|
||||||
|
|
||||||
# Catch the args after --
|
# Catch the args after --
|
||||||
if (( $# )); then
|
if (( $# )); then
|
||||||
args+=( "$@" )
|
args+=( "$@" )
|
||||||
|
|
Loading…
Reference in New Issue
Block a user