{{- if (eq .host.distro.family "linux") -}}
#!/usr/bin/env bash

{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}

### Install Visual Studio Code extensions
if command -v code > /dev/null; then
    EXTENSIONS="$(code --list-extensions)"
    jq -r '.recommendations[]' "${XDG_CONFIG_HOME:-$HOME/.config}/Code/User/extensions.json" | while read EXTENSION; do
        if ! echo "$EXTENSIONS" | grep -iF "$EXTENSION" > /dev/null; then
            logg info 'Installing Visual Studio Code extension `'"$EXTENSION"'`'
            code --install-extension "$EXTENSION"
            logg success 'Installed `'"$EXTENSION"'`'
        else
            logg info '`'"$EXTENSION"'` already installed'
        fi
    done
else
    logg warn '`code` executable not available'
fi

### Install VSCodium extensions
if command -v codium > /dev/null; then
    EXTENSIONS="$(codium --list-extensions)"
    jq -r '.recommendations[]' "${XDG_CONFIG_HOME:-$HOME/.config}/Code/User/extensions.json" | while read EXTENSION; do
        if ! echo "$EXTENSIONS" | grep -iF "$EXTENSION" > /dev/null; then
            logg info 'Installing VSCodium extension `'"$EXTENSION"'`'
            codium --install-extension "$EXTENSION"
            logg success 'Installed `'"$EXTENSION"'`'
        else
            logg info '`'"$EXTENSION"'` already installed'
        fi
    done
else
    logg warn '`codium` executable not available'
fi

{{ end -}}
