From cdf03f340e6117f4384967d0d946fe8fd4dc9dd5 Mon Sep 17 00:00:00 2001 From: epoch Date: Tue, 21 Jan 2020 10:41:50 -0600 Subject: added ability to --check what uristart would do, then noticed I wasn't clipping ALL of the leading whitespace, so fixed that. --- uristart | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/uristart b/uristart index 3acf785..b3feb81 100755 --- a/uristart +++ b/uristart @@ -8,9 +8,16 @@ ##might have to configure me. ASKUSER="dmenu -p" +if [ "$1" = "--check" ];then + check=1 + shift +else + check=0 +fi + uri="${1}" scheme="$(printf "%s\n" "$uri" | uricut -s)" -line="$(grep "^${scheme}:" ~/.config/uristart.conf | cut -d: -f2- | sed 's/^[ \t]//g' | sed 's/\\/\\\\/g')" +line="$(grep "^${scheme}:" ~/.config/uristart.conf | cut -d: -f2- | sed 's/^[ \t]*//g' | sed 's/\\/\\\\/g')" ### if we do not have a port, we are going to try to get it from their srv records. if printf "%s\n" "$uri" | urimatch nP >/dev/null;then @@ -33,7 +40,7 @@ if printf "%s\n" "$uri" | urimatch nP >/dev/null;then #if we *still* don't have fi ### ask the user for a pipeline for starting these URIs if there isn't a pipeline already in the config. -echo "the uri we're using: $uri" +echo "the uri we're using: $uri" >&2 if [ "$line" = "" ];then line="$(printf "" | $ASKUSER "protocol scheme (${scheme}) not configured yet. enter new pipeline to use:")" if [ "$line" = "" ];then @@ -53,4 +60,8 @@ if ! cut '-d ' -f1 ~/.cache/uristart.log | grep -Fx "$uri" 2>&1 >/dev/null;then fi ### do the magic -eval "$(printf "%s\n" "$uri" | sed 's/'\''/'\''\\'\'''\''/g' | uriprintf "$line")" +if [ "$check" ];then + printf "%s\n" "$(printf "%s\n" "$uri" | sed 's/'\''/'\''\\'\'''\''/g' | uriprintf "$line")" +else + eval "$(printf "%s\n" "$uri" | sed 's/'\''/'\''\\'\'''\''/g' | uriprintf "$line")" +fi -- cgit v1.2.3