Handle --names and --names-exclude options correctly