code / tomo

Lines41.3K C23.7K Markdown9.7K YAML5.0K Tomo2.3K
7 others 763
Python231 Shell230 make212 INI47 Text21 SVG16 Lua6
(48 lines)
1 '\" t
2 .\" Copyright (c) 2025 Bruce Hill
3 .\" All rights reserved.
4 .\"
5 .TH Path.glob 3 2025-11-29 "Tomo man-pages"
6 .SH NAME
7 Path.glob \- perform file globbing
8 .SH LIBRARY
9 Tomo Standard Library
10 .SH SYNOPSIS
11 .nf
12 .BI Path.glob\ :\ func(path:\ Path\ ->\ [Path])
13 .fi
14 .SH DESCRIPTION
15 Perform a globbing operation and return a list of matching paths. Some glob specific details:
16 - The paths "." and ".." are *not* included in any globbing results.
17 - Files or directories that begin with "." will not match `*`, but will match `.*`.
18 - Globs do support `{a,b}` syntax for matching files that match any of several
19 choices of patterns.
21 - The shell-style syntax `**` for matching subdirectories is not supported.
24 .SH ARGUMENTS
26 .TS
27 allbox;
28 lb lb lbx
29 l l l.
30 Name Type Description
31 path Path The path of the directory which may contain special globbing characters like \fB*\fR, \fB?\fR, or \fB{...}\fR
32 .TE
33 .SH RETURN
34 A list of file paths that match the glob.
36 .SH EXAMPLES
37 .EX
38 # Current directory includes: foo.txt, baz.txt, qux.jpg, .hidden
39 assert (./*).glob() == [(./foo.txt), (./baz.txt), (./qux.jpg)]
40 assert (./*.txt).glob() == [(./foo.txt), (./baz.txt)]
41 assert (./*.{txt,jpg}).glob() == [(./foo.txt), (./baz.txt), (./qux.jpg)]
42 assert (./.*).glob() == [(./.hidden)]
44 # Globs with no matches return an empty list:
45 assert (./*.xxx).glob() == []
46 .EE
47 .SH SEE ALSO
48 .BR Tomo-Path (3)