volgens Tim Hunt.
Well, http://docs.moodle.org/dev/Backup_2.0_for_developers#Setting_up_the_environment has a script that shows the necssary code.
You just need to package something like that in a wrapper to parse the command-line arguments.