Print or send to clipboard the result

This commit is contained in:
Jeremy Gardais 2020-03-11 16:59:09 +01:00
parent 32a58d8c83
commit f9d4d262e0
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 14 additions and 0 deletions

View File

@ -56,4 +56,18 @@ fi
# shorten URL # shorten URL
result=$(curl -sF"shorten=${url_to_short}" "${null_service_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 exit 0