hbc/qualified_token: use regex captures instead of String#split
This commit is contained in:
parent
c7e6613f7b
commit
b2870c2480
@ -2,10 +2,8 @@ module Hbc
|
||||
module QualifiedToken
|
||||
def self.parse(arg)
|
||||
return nil unless arg.is_a?(String)
|
||||
return nil unless arg.downcase =~ HOMEBREW_TAP_CASK_REGEX
|
||||
# eg caskroom/cask/google-chrome
|
||||
# per https://github.com/Homebrew/brew/blob/master/docs/brew-tap.md
|
||||
user, repo, token = arg.downcase.split("/")
|
||||
return nil unless match = arg.downcase.match(HOMEBREW_TAP_CASK_REGEX)
|
||||
user, repo, token = match.captures
|
||||
odebug "[user, repo, token] might be [#{user}, #{repo}, #{token}]"
|
||||
[user, repo, token]
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user