Batch mode

wip, doesn't compile yet.

the option parsing is very simplistic, but i don't think we need more than that.