-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsurf.sh
More file actions
executable file
·48 lines (42 loc) · 1.36 KB
/
surf.sh
File metadata and controls
executable file
·48 lines (42 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
if [ "$1" == "" ] || [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
echo ""
echo "---------------------Github Surf 🏄♂️-------------------"
echo ""
echo "Development By @Bridged"
echo "📮 Report To https://github.com/bridgedxyz/surf-cli/issues"
echo ""
echo "---------------------Command List---------------------"
echo ""
echo "surf -h, surf --help, surf : Show Command List"
echo "surf . : Open Current Directory"
echo "surf .. : Open Current Directory Use Visual Studio Code"
echo "surf . -b <branch-name> : Open Current Directory + Other Branch"
echo ""
exit 0;
fi
ROUTE_NAME="$(git config --get remote.origin.url | sed 's/.*\/\([^ ]*\/[^.]*\)/\1/')"
MAIN_URL="https://github.surf/"
ROUTE_SIZE=${#ROUTE_NAME}
WARP_ROUTE_NAME=${ROUTE_NAME:0:ROUTE_SIZE-4}
if [ $(find .git | wc -l) == 0 ]; then
echo ""
echo "There is no github setting."
echo "Please proceed with github initial setup."
exit 9;
fi
if [ "$1" == ".." ]; then
open -a Visual\ Studio\ Code.app .
exit 3;
fi
if [ "$1" == "-b" ]; then
python -m webbrowser $MAIN_URL$WARP_ROUTE_NAME+$2
exit 2
elif [ "$2" == "-b" ]; then
python -m webbrowser $MAIN_URL$WARP_ROUTE_NAME+$3
exit 2
fi
if [ "$1" == "." ]; then
python -m webbrowser $MAIN_URL$WARP_ROUTE_NAME
exit 1
fi