Separate CLI into its own file

I was getting syntax errors from Webpack because you start `index.js` with a hashbang.  I broke out the core functionality into its own file to ameliorate this.  The logic is all the same.