#!/usr/bin/env sh
echo "Running installation script\n"
{{- if eq .osid "linux-alpine" }}
apk update
apk add bash fish
{{- else if (eq .osid "debian" "ubuntu" "zorin") }}
sudo apt-add-repository ppa:fish-shell/release-3
sudo apt update
sudo apt install bash fish -y 
chsh -s $(which fish)
{{- else if eq .osid "darwin" }}
brew install neovim tmux perl fish
chsh -s $(which fish)
{{- end }}


curl https://raw.githubusercontent.com/candrewlee14/webman/main/scripts/install.sh | sh
~/.webman/bin/webman group add modern-unix --all || echo "Not all modern-unix packages installed successfully"
~/.webman/bin/webman add fzf || echo "Fzf install failed"
~/.webman/bin/webman add zellij || echo "zellij install failed"
~/.webman/bin/webman add nvim || echo "nvim install failed"

/usr/bin/env fish ~/.config/fish/.on_install.fish

git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim
git clone https://github.com/candrewlee14/astronvim_config ~/.config/nvim/lua/user

if test -x ~/.webman/bin/nvim; then
  ~/.webman/bin/nvim --headless +q
else
  echo "~/.webman/bin/nvim does not exist or is not executable"
fi
