glob
lib/glob.vklib/glob.vk
Pure-Veko linear-time glob pattern matcher (*, **, ?, [a-z], [!a-z]).
Zero capabilities required.
match? = fn [pattern str, target str] bool
Matches target against glob pattern (* matches non-/, ** matches across /,
? matches one non-/, [abc]/[a-z]/[!0-9] matches a character class).
Executable Example
use [glob]
a = glob/match? 'src/**/*.vk' 'src/crypto/sha256.vk'
b = glob/match? 'lib/*.vk' 'lib/sub/a.vk'
c = glob/match? 'file_[0-9].txt' 'file_7.txt'
if (not a) or b or (not c) [ err 'glob/match?' ] else [ .ok ]
filter = fn [pattern str, paths block[str]] block[str]
Filters paths returning all strings matching glob pattern.