Backported command-line behavior from master.