Better handle --prefix on the command line.

Refactored CLI interface to use promises, so that we can do an async
query for prefix information.  This removes a few more hacks that depend
on wikimedia-style API URLs.