#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'

# Display a list of software versions dotfiles is interested in.

echo 'Installed:'

version_commands=( \
  'git version' \
  'bash --version' \
  'zsh --version' \
  'tmux -V' \
  'vim --version' \
  'nvim -v' \
  'rg -V' \
  'pandoc -v' \
  'pandoc-citeproc -V' \
  'tmuxinator version' \
  'pygmentize -V' \
  'source-highlight -V' \
  )

for ver_com in ${version_commands[@]}; do
  # Get the executable name.
  com=${ver_com%% *}
  # Report version if executable exists, otherwise report none.
  if [[ -n $(command -v $com) ]]; then
    eval "$ver_com" | head -n 1 || true
  else
    echo "$com - none"
  fi
done
