From f9d4d262e03a33a0446d3ee76859acb151f97db3 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Wed, 11 Mar 2020 16:59:09 +0100 Subject: [PATCH] Print or send to clipboard the result --- url.shortme.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/url.shortme.sh b/url.shortme.sh index ace5cdf..ecd6818 100755 --- a/url.shortme.sh +++ b/url.shortme.sh @@ -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