commit 3871d15df415a08383f8e47cad4b53838b4de64d
parent 355fbcde2ad401aa955694cc7ce867376629e613
Author: Brian Mayer <bleemayer@gmail.com>
Date: Mon, 5 Jul 2021 02:10:38 -0300
Improved protocol parsing
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/astro b/astro
@@ -5,9 +5,9 @@
parseurl() {
# Credits: https://stackoverflow.com/a/6174447/7618649
# extract the protocol
- proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')"
+ proto="$(echo $1 | grep :// | sed -e's,^\(.*\)://.*,\1,g')"
# remove the protocol
- url="$(echo ${1/$proto/})"
+ url="$(echo ${1/"$proto://"/})"
# extract the user (if any)
user="$(echo $url | grep @ | cut -d@ -f1)"
# extract the host and port
@@ -119,6 +119,8 @@ args="$@"
# Save terminal
tput smcup
+echo $(parseurl "$args")
+
# First request
fetch $(parseurl "$args") | parsegemini
@@ -132,3 +134,4 @@ do
printf '\n%*s\n' $(tput cols) | tr ' ' '#'
fetch $(parseurl "$opt") | parsegemini
done
+