Try to keep the metadata consistent when saving them to disk.
Update CHANGES
Change the way we detect existing commands

`which` seems not very portable, so use `type` instead, because "type is standardized in POSIX" (thx @dbuenzli).

This should fix #471 and improve the BSD support.
Update CHANGES
Revert "Change the way we detect existing commands"

This reverts commit e157b5fd1e1bbe1749b2440487d3b7995592f356.
Improve the API. There are still some global state (the main one being the filesystem -- it will be quite hard to abstract other it I'm afraid) but it's now easier to do all of the action available on the command-line using the API.

An example:

   let pkgs = OpamPackage.Name.Set.of_list [OpamPackage.Name.of_string "core"] in
   OpamClient.API.install pkgs

The message are still displayed on stdout/stderr so that could be a bit awkward.