Made generate commands work and switched from escapeshellarg to escapeshellcmd.

Also allowed migrate to be somewhat configurable.