blob: 1e593035a0ca6fbed9ee415ef79597e7409e64b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
'\" 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)
|