Bugfix: support -t and -d again

Due to the awesome refactoring in
fe3244ca9c8c9a38ea700851e36667b1015d11e6, the `-t` and `-d` options were
broken. Fix it by removing the `handle_metadata_flags` function and
inlining the code again, and build the `LS_ARGS` argument differently.

Clearly I need a test suite.