Parcourir la source

Improve `show-versions`

Will now display which things are not installed.
Weiyi Lou il y a 9 ans
Parent
commit
f399911c2e
1 fichiers modifiés avec 23 ajouts et 10 suppressions
  1. 23 10
      bin/show-versions

+ 23 - 10
bin/show-versions

@@ -4,13 +4,26 @@ IFS=$'\n\t'
 
 # Display a list of software versions dotfiles is interested in.
 
-echo "Installed:"
-command -v git >/dev/null && git version || true
-command -v bash >/dev/null && bash --version | head -n 1 || true
-command -v zsh >/dev/null && zsh --version || true
-command -v tmux >/dev/null && tmux -V || true
-command -v vim >/dev/null  && vim --version | head -n 1 || true
-command -v nvim >/dev/null && nvim -v | head -n 1 || true
-command -v ag >/dev/null && ag --version | head -n 1 || true
-command -v pandoc >/dev/null && pandoc -v | head -n 1 || true
-command -v pandoc-citeproc >/dev/null && pandoc-citeproc -V | head -n 1 || true
+echo 'Installed:'
+
+version_commands=( \
+  'git version' \
+  'bash --version' \
+  'zsh --version' \
+  'tmux -V' \
+  'vim --version' \
+  'nvim -v' \
+  'ag --version' \
+  'pandoc -v' \
+  'pandoc-citeproc -V' \
+  'tmuxinator version' \
+  )
+
+for ver_com in ${version_commands[@]}; do
+  com=${ver_com%% *}
+  if [[ -n $(command -v $com) ]]; then
+    eval "$ver_com" | head -n 1
+  else
+    echo "$com - none"
+  fi
+done