Moved stuff shared by new cmdln utilities to lib/shared.js