JustBash.Interpreter.Expansion.Glob (JustBash v0.4.0)
View SourceGlob expansion and pattern matching utilities.
Handles:
- Filename expansion: *, ?, [...]
- IFS word splitting
- Converting glob patterns to regex
Summary
Functions
Expand a glob pattern against the filesystem. Returns a list of matching filenames, or the original pattern if no matches.
Convert a glob pattern to a regex pattern string.
Check if a string contains glob metacharacters.
Split a string on IFS characters.
Functions
@spec expand(JustBash.t(), String.t()) :: [String.t()]
Expand a glob pattern against the filesystem. Returns a list of matching filenames, or the original pattern if no matches.
Handles wildcards in any path segment, not just the filename. For example: /tmp//file.txt or /a//b/*.log
Trailing slashes are preserved: /tmp/*/ expands to /tmp/foo/, /tmp/bar/
Convert a glob pattern to a regex pattern string.
Check if a string contains glob metacharacters.
Split a string on IFS characters.