123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 | '\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Path.glob 3 2025-11-29 "Tomo man-pages"
.SH NAME
Path.glob \- perform file globbing
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Path.glob\ :\ func(path:\ Path\ ->\ [Path])
.fi
.SH DESCRIPTION
Perform a globbing operation and return a list of matching paths. Some glob specific details:
- The paths "." and ".." are *not* included in any globbing results.
- Files or directories that begin with "." will not match `*`, but will match `.*`.
- Globs do support `{a,b}` syntax for matching files that match any of several
choices of patterns.
- The shell-style syntax `**` for matching subdirectories is not supported.
.SH ARGUMENTS
.TS
allbox;
lb lb lbx
l l l.
Name Type Description
path Path The path of the directory which may contain special globbing characters like \fB*\fR, \fB?\fR, or \fB{...}\fR
.TE
.SH RETURN
A list of file paths that match the glob.
.SH EXAMPLES
.EX
# Current directory includes: foo.txt, baz.txt, qux.jpg, .hidden
assert (./*).glob() == [(./foo.txt), (./baz.txt), (./qux.jpg)]
assert (./*.txt).glob() == [(./foo.txt), (./baz.txt)]
assert (./*.{txt,jpg}).glob() == [(./foo.txt), (./baz.txt), (./qux.jpg)]
assert (./.*).glob() == [(./.hidden)]
# Globs with no matches return an empty list:
assert (./*.xxx).glob() == []
.EE
.SH SEE ALSO
.BR Tomo-Path (3)
|