File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 3
3
#
4
4
# Reloads the active tab of the given browser (defaults to Chrome).
5
5
# Keeps the browser window in the background (Chrome/Safari only).
6
+ # Can optionally execute a given command before reloading the browser tab.
7
+ # Browser reloading is supported on MacOS only for now.
6
8
#
7
- # Usage: ./macos- reload-browser.sh [chrome|safari|firefox]
9
+ # Usage: ./reload-browser.sh [chrome|safari|firefox] -- [command args...]
8
10
#
9
11
12
+ set -e
13
+
10
14
RELOAD_CHROME=' tell application "Google Chrome"
11
15
reload active tab of window 1
12
16
end tell'
@@ -24,4 +28,11 @@ case "$1" in
24
28
* ) OSASCRIPT=$RELOAD_CHROME ;;
25
29
esac
26
30
27
- exec osascript -e " $OSASCRIPT "
31
+ if shift ; then
32
+ [ " $1 " = " --" ] && shift
33
+ " $@ "
34
+ fi
35
+
36
+ if command -v osascript > /dev/null 2>&1 ; then
37
+ exec osascript -e " $OSASCRIPT "
38
+ fi
You can’t perform that action at this time.
0 commit comments