Make 'opam config var switch' print the current switch

This can be useful when substituting variables in .opam files.
Fix #360

OPAM now fails if curl returns an error (it should already work properly when using wget).

It will also help fixing #452 and #467
Add more logging to help debugging #479