diff --git a/.config/fish/functions/vitally-init.fish b/.config/fish/functions/vitally-init.fish new file mode 100644 index 0000000..f25f253 --- /dev/null +++ b/.config/fish/functions/vitally-init.fish @@ -0,0 +1,5 @@ +function vitally-init + yarn bootstrap + yarn build + yarn migrate +end diff --git a/.config/fish/functions/vitally-session-name.fish b/.config/fish/functions/vitally-session-name.fish new file mode 100644 index 0000000..8ab0e11 --- /dev/null +++ b/.config/fish/functions/vitally-session-name.fish @@ -0,0 +1,3 @@ +function vitally-session-name + echo "vitally" +end diff --git a/.config/fish/functions/vitally-start.fish b/.config/fish/functions/vitally-start.fish new file mode 100644 index 0000000..de95cea --- /dev/null +++ b/.config/fish/functions/vitally-start.fish @@ -0,0 +1,20 @@ +function vitally-start + set session $(vitally session-name) + set workdir $(pwd) + + vitally stop + + tmux new-session -d -s $session -c $workdir + tmux new-window -t "$session:" -n "build" -c $workdir + tmux new-window -t "$session:" -n "client" -c $workdir + tmux new-window -t "$session:" -n "server" -c $workdir + tmux new-window -t "$session:" -n "surveys-api" -c $workdir + tmux new-window -t "$session:" -n "job-runner" -c $workdir + + tmux send-keys -t "$session:build" "yarn migrate" Enter + tmux send-keys -t "$session:build" "yarn build:watch" Enter + tmux send-keys -t "$session:client" "sleep 30; yarn client:start" Enter + tmux send-keys -t "$session:server" "sleep 35; yarn server:start" Enter + tmux send-keys -t "$session:surveys-api" "sleep 35; yarn surveys:start" Enter + tmux send-keys -t "$session:job-runner" "sleep 40; yarn job-runner:start" Enter +end diff --git a/.config/fish/functions/vitally-stop.fish b/.config/fish/functions/vitally-stop.fish new file mode 100644 index 0000000..98910ba --- /dev/null +++ b/.config/fish/functions/vitally-stop.fish @@ -0,0 +1,3 @@ +function vitally-stop + tmux kill-session -t $(vitally session-name) > /dev/null 2>&1 +end diff --git a/.config/fish/functions/vitally.fish b/.config/fish/functions/vitally.fish new file mode 100644 index 0000000..68b3c66 --- /dev/null +++ b/.config/fish/functions/vitally.fish @@ -0,0 +1,9 @@ +function vitally + set cmd $argv[1] + set cmds start stop session-name + if not contains $cmd $cmds + echo "usage: vitally ; : start, stop, session-name" + else + eval "vitally-$cmd" + end +end