CLI-265: Optional argument picking up next regular option as its argument. Extend fix to address problems identified by Martin Sandiford who also submitted the extended patch.