Add beforecmd.

This lets you run a custom command right before going away to pair with
cmd which lets you set a command to run on return.