Skip to content

Instantly share code, notes, and snippets.

@worthmine
Last active October 24, 2020 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save worthmine/0b3da902bd01647bbdd7292836756d5a to your computer and use it in GitHub Desktop.
Save worthmine/0b3da902bd01647bbdd7292836756d5a to your computer and use it in GitHub Desktop.
run and open zenn preview automatically from terminal of your Mac
#!/bin/sh
SOURCE="npx zenn preview"
export DIR="~/Zenn" # 各自のディレクト名にリネームしてください。
if [[ "$(uname)" = "Darwin" ]] && [[ -z "$ON_NEW_TERMINAL" ]] && [[ -z "$NO_NEW_TERMINAL" ]] ; then
osascript -e "
tell application \"Terminal\"
do script \"cd $DIR && $SOURCE\" in window 1
end tell
tell application \"System Events\"
keystroke \"t\" using command down
end tell
tell application \"Terminal\"
do script \"cd $DIR && code ./articles \" in window 1
end tell
-- Safariの人はSafariを指定してください
delay 6.0
tell application \"Google Chrome\"
activate
open location \"http://localhost:8000\"
end tell"
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment