Allow glob matches for roles and hosts
This lets you do things like:
```
kamal details -h '1.1.1.[1-9]'
kamal details -r 'w{eb,orkers}'
```
This commit is contained in:
@@ -66,13 +66,12 @@ module Kamal::Utils
|
||||
Array(filters).select do |filter|
|
||||
matches += Array(items).select do |item|
|
||||
# Only allow * for a wildcard
|
||||
pattern = Regexp.escape(filter).gsub('\*', ".*")
|
||||
# items are roles or hosts
|
||||
(item.respond_to?(:name) ? item.name : item).match(/^#{pattern}$/)
|
||||
File.fnmatch(filter, item.to_s, File::FNM_EXTGLOB)
|
||||
end
|
||||
end
|
||||
|
||||
matches
|
||||
matches.uniq
|
||||
end
|
||||
|
||||
def stable_sort!(elements, &block)
|
||||
|
||||
Reference in New Issue
Block a user