Implement --file option, with associated tests.

Resolves #1.