cmd/--repository: improve tap name error checking

Before:

    $ brew --repo core
    /usr/local/Homebrew/Library/Taps/core/homebrew-core

After:

    $ brew --repo core
    Error: Invalid tap name: core
This commit is contained in:
Ruoyu Zhong 2024-07-14 13:17:26 -04:00
parent 2d26c89e81
commit 64838db963
No known key found for this signature in database

View File

@ -13,6 +13,11 @@ tap_path() {
local repo
local part
if [[ "${tap}" != *"/"* ]]
then
odie "Invalid tap name: ${tap}"
fi
user="$(echo "${tap%%/*}" | tr '[:upper:]' '[:lower:]')"
repo="$(echo "${tap#*/}" | tr '[:upper:]' '[:lower:]')"