helper method for testing existence of commands

Replaced multiple `type "..."` and `which ...` calls with a convenient helper function `has "..."`.