show-versions 668 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. IFS=$'\n\t'
  4. # Display a list of software versions dotfiles is interested in.
  5. echo 'Installed:'
  6. version_commands=( \
  7. 'git version' \
  8. 'bash --version' \
  9. 'zsh --version' \
  10. 'tmux -V' \
  11. 'vim --version' \
  12. 'nvim -v' \
  13. 'rg -V' \
  14. 'pandoc -v' \
  15. 'pandoc-citeproc -V' \
  16. 'tmuxinator version' \
  17. 'pygmentize -V' \
  18. 'source-highlight -V' \
  19. )
  20. for ver_com in ${version_commands[@]}; do
  21. # Get the executable name.
  22. com=${ver_com%% *}
  23. # Report version if executable exists, otherwise report none.
  24. if [[ -n $(command -v $com) ]]; then
  25. eval "$ver_com" | head -n 1 || true
  26. else
  27. echo "$com - none"
  28. fi
  29. done