Use `command -v` instead of `which`.

Based on https://github.com/pote/gpm/pull/24.