Convert commands to support hooks

This defines a new function in cmd_entry called prepare() which is
responsible for setting up the commands's execution context.  For hooks in
particular, this is important because a command that's run in tmux assumes
it's operating from where it was started if no other options like -t/-s are
given to affect which session or client or window, etc., the command should
use.

In the case of hooks, those commands should act upon the same context
(session, window, client, etc.) as the command that's been invoked -- and
hence this has to be done ahead of time before the command is run.
Fix select-window when using prepare()

The same option (-t) can be used more than once in different context to mean
either selecting sessions or windows, depending on the command actually
being used.  We need to capture this logic in prepare().