Skip to content

Commit

Permalink
dev(anni): add kitty script for dev setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jannis-baum committed Jul 3, 2022
1 parent 0335923 commit d5847d0
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .kitty/annotation-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh

if [ "$1" = "-h" -o "$1" = "--help" ]; then
echo 'Annotation dev setup for kitty terminal'
echo ' Starts the Annotation Interface, Server and their databases in split windows.'
echo " Run from the repository's root."
echo ''
echo 'optional arguments:'
echo ' -h, --help show this message and exit'
echo ' -s, --server run the Annotation Server instead of the Interface (default)'
echo ' in the tallest window'
exit 0
fi

if [ "$TERM" != "xterm-kitty" ]; then
echo 'Unsupported terminal.'
exit 1
fi

if [ ! -d annotation-interface -o ! -d annotation-server ]; then
echo "Run from the repository's root."
exit 1
fi


CWD=`pwd`

AS=('cd annotation-server && yarn start:dev' 'cd annotation-server && docker compose up')
AI=('cd annotation-interface && yarn dev' 'cd annotation-interface && docker compose up')

if [ "$1" = "-s" -o "$1" = "--server" ]; then
MAIN=("${AS[@]}")
SEC=("${AI[@]}")
else
MAIN=("${AI[@]}")
SEC=("${AS[@]}")
fi

kitty @ launch --cwd=$CWD --location=vsplit &>/dev/null && kitty @ send-text "${SEC[0]}\n"
kitty @ launch --cwd=$CWD --location=hsplit &>/dev/null && kitty @ send-text "${SEC[1]}\n"
kitty @ launch --cwd=$CWD --location=hsplit &>/dev/null && kitty @ send-text "${MAIN[1]}\n"
eval "${MAIN[0]}"
6 changes: 6 additions & 0 deletions annotation-interface/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ Please also see the [contribution guide in the root folder](../CONTRIBUTING.md).
- Start the database by running `docker compose up` in this directory
- Start the development server with `yarn dev`
- You can now access the annotation interface app on `localhost:3001`

If you have all prerequisites (Annotation Server & Interface) met and use
[kitty](https://sw.kovidgoyal.net/kitty/), you can conveniently run the
[annotation-dev](../.kitty/annotation-dev) script from this repository's root to
start both the Annotation Server and Interface along with both databases in
split windows.

0 comments on commit d5847d0

Please sign in to comment.