api: Implement vim_command_output function

This function can be used by API clients to execute a command and capture the
output.
functional test