Print or send to clipboard the result

This commit is contained in:
gardouille 2020-03-11 16:59:09 +01:00
parent 32a58d8c83
commit f9d4d262e0
Signed by: gardouille
GPG Key ID: E759BAA22501AF32

View File

@ -56,4 +56,18 @@ fi
# shorten URL
result=$(curl -sF"shorten=${url_to_short}" "${null_service_url}")
# Manage the result [[[
## If the URL should simply be printed to stdout
if [ "${flag_inline}" = "true" ]; then
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG Manage result: Print the result on stdout:"
printf "%b\n" "${result}"
fi
# If the URL should remplace the previous content of the clipboard
if [ "${flag_clipboard}" = "true" ]; then
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG Manage result: Put the result in clipboard."
echo "${result}" | xclip -rmlastnl -selection clipboard
fi
# ]]]
exit 0