convert: Add --format option

This option allows the user to specify the format on the command line
instead of editing the configuration.

The commit also includes some refactoring. In particular adding
arguments to functions to avoid dependence on global state.

Doc and Changelog in next commit
Documentation and changelog for b2740968
convert: Simplify format configuration.

We don't have to specify the extension. By default it is the same as
the format name.