Skip to content

Instantly share code, notes, and snippets.

@peter
Created April 11, 2019 09:01
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 peter/dfc47a16546aa964381e8c15e2e04558 to your computer and use it in GitHub Desktop.
Save peter/dfc47a16546aa964381e8c15e2e04558 to your computer and use it in GitHub Desktop.
Script to open terminal tabs and run commands on Mac

Open Terminal Tabs on Mac and Run Commands

Dependencies

Requires Node.js and ttab

npm install ttab -g

Script to Start Server

In ~/bin/start:

#!/usr/bin/env bash

dir=$(basename $(pwd))

if [ "$dir" == "hyperion" ]; then
   command="env IRIS_HOST=http://localhost:4000 npm start"
elif [ "$dir" == "iris-core" ]; then
   command="env LOG_LEVEL=debug IRIS_SITE=aftonbladet npm run start:dev:watch"
else
   echo "Don't know how to start app in dir $dir"
   exit 1
fi

echo "starting app in $dir: $command"
$command

Script to Open Terminal Tabs

In ~/bin/open-dev:

#!/usr/bin/env bash

ttab "cd ~/src/hyperion"
ttab "cd ~/src/hyperion && start"

ttab "cd ~/src/iris-core"
ttab "cd ~/src/iris-core && start"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment