use ui.writeError in lib/cli/cli.js

fixes GH-2254
this is good.