#!/bin/bash

set -e

FILESHARE=false
WEB=false

while getopts f opt; do
    case $opt in
        f) FILESHARE=true ;;
        w) WEB=true ;;
    esac
done

tmux new-session -d -s test
tmux send-keys -t test "a serve" Enter

tmux new-window -t test
tmux send-keys -t test "SS start docker && duu meilisearch" Enter

tmux new-window -t test
tmux send-keys -t test "SS start docker && duu socketi" Enter

tmux new-window -t test
tmux send-keys -t test "nrh" Enter

$WEB && tmux new-window -t test
$WEB && tmux send-keys -t test "ggwdk && cd plugins/silva/adrema/assets/vendor/adrema-form && nrd" Enter

$FILESHARE && tmux new-window -t test
$FILESHARE && tmux send-keys -t test "cd tests/Fileshare && docker compose up" Enter

tmux attach-session -t test

