diff --git a/.kitty/annotation-dev b/.kitty/annotation-dev new file mode 100755 index 000000000..a0e43d630 --- /dev/null +++ b/.kitty/annotation-dev @@ -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]}" diff --git a/annotation-interface/CONTRIBUTING.md b/annotation-interface/CONTRIBUTING.md index 823eaf56a..9a1ba2c01 100644 --- a/annotation-interface/CONTRIBUTING.md +++ b/annotation-interface/CONTRIBUTING.md @@ -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.