diff options
author | epoch <epoch@enzo.thebackupbox.net> | 2021-10-20 22:51:31 +0000 |
---|---|---|
committer | epoch <epoch@enzo.thebackupbox.net> | 2021-10-20 22:51:31 +0000 |
commit | 80050281a53813021abe6ee7f6d12535d1337774 (patch) | |
tree | 227e35e29b19c004e63002050e8aaa12d04a8cd9 | |
parent | 3918ca258881537fdc3ce0b4fa92cf8d0d96f434 (diff) | |
download | uritools-80050281a53813021abe6ee7f6d12535d1337774.tar.gz uritools-80050281a53813021abe6ee7f6d12535d1337774.zip |
prompt was empty if URL was short enough.
-rwxr-xr-x | copy_start_nevermind.sh | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/copy_start_nevermind.sh b/copy_start_nevermind.sh index 3f7f7af..66bf922 100755 --- a/copy_start_nevermind.sh +++ b/copy_start_nevermind.sh @@ -1,16 +1,35 @@ #!/bin/bash [ "$1" ] || exit 1 uri="$1" + +queryfiltereduri="$(uriqueryfilter "$uri")" +if [ "$uri" != "$queryfiltereduri" ];then + trackeruri="$uri" + uri="$queryfiltereduri" +fi + +### this clipping should be part of choose probably if [ "${uri}" != "${uri:0:64}" ];then prompt="${uri:0:64}..." +else + prompt="${uri}" fi + scheme="$(uricut -s <<< "$uri")" -selection="$(printf "start with: %s\ncopy\nshorten\nverbose\nforget\nQR\n%s\n" "$(urigetline "$uri")" "$(printf "%s\n" "$uri" | uricut | grep -v '^whole')" \ +selection="$(printf "start with: %s\nremote_csn\ncopy\nshorten\nunshorten\ntitle\nverbose\nforget\nQR\n%s\n" "$(urigetline "$uri")" "$(printf "%s\n" "$uri" | uricut | grep -v '^whole')" \ | choose "${prompt}")" # | choose "$(printf "uri: '%s'\nwill be ran with: %s\n" "$uri" "$(urigetline "$uri")" )" -default start )" echo "$selection" case "$selection" in +remote_csn) + remote_host="$(choose "remote host to run URI on> " < ~/.config/urirhosts.conf)" + ### TODO: include in the list our own display either to use -X or use our IP and display number? + display="$(ssh "${remote_host}" myXdisplays | choose "which display?")" + uristart "ssh://${remote_host}/copy_start_nevermind.sh%20${uri}?DISPLAY=$display" + exit 0 + ;; + verbose) x-terminal-emulator -e less -f <(printf "%s" "$uri") exit 0 @@ -21,6 +40,11 @@ copy) exit 0 ;; +title) + copy_start_nevermind.sh "$(urititle "$uri")" + exit 0 + ;; + forget) cp ~/.cache/uristart.log ~/.cache/uristart.log.tmp cat ~/.cache/uristart.log.tmp | grep -vFw "${uri}" > ~/.cache/uristart.log @@ -44,11 +68,18 @@ shorten) exit 0 ;; +unshorten) + copy_start_nevermind.sh "$(unshorten.sh "$uri")" + exit 0 + ;; + QR) x-terminal-emulator -hold -e qr "$uri" ;; *) - exec printf "%s" "$selection" | cut '-d ' -f2- | xclip -i + if [ "$selection" ];then + exec printf "%s" "$selection" | cut '-d ' -f2- | xclip -i + fi ;; esac |