How to unite `brew` and `brew cask` into one command?

Solution 1:

Put this function to .zshrc. It tries to install a cask, then a formula:

bru () {
    ! ( brew cask install "$argv[@]" ) && brew install "$argv[@]"
}