Skip to content

Commit b4f2686

Browse files
author
xero
committed
remove bashisms and make domain regex more unixy. thanx @z3bratabs and @dcat
1 parent 1815cbe commit b4f2686

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

gitio

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
# ▜▛
1717
# xero / syntax-samurai <http://git.io/gitio.sh>
1818

19-
URLREGX='(https?|http)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
20-
GHURL=
21-
VANITY=
22-
2319
usage () {
2420
cat <<EOF
2521
@@ -44,24 +40,24 @@ err() {
4440
}
4541

4642
optstest() {
47-
FOUND=0
48-
for var in "$@"
43+
found=0
44+
for arg in "$@"
4945
do
50-
if [[ $var =~ $URLREGX ]]
46+
if echo $arg | awk -F/ '{print $3}' | grep -Eq "github.com"
5147
then
52-
GHURL=$var
53-
FOUND=1
54-
elif [[ $var == "-h" ]]
48+
GHURL=$arg
49+
found=1
50+
elif [ $arg = "-h" ]
5551
then
5652
usage
57-
elif [[ $var == "-v" ]]
53+
elif [ $arg = "-v" ]
5854
then
59-
X=
55+
:
6056
else
61-
VANITY=$var
57+
VANITY=$arg
6258
fi
6359
done
64-
if (( FOUND == 0 ))
60+
if [ $found = 0 ]
6561
then
6662
err " must be a valid github.com url!"
6763
fi

0 commit comments

Comments
 (0)