aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-Path.glob.3
blob: 9be429cc786fc194524fdf3a71e56bd21dbd0b75 (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
49
50
51
52
53
54
55
56
57
58
59
60
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Path.glob 3 2025-04-19T14:52:07.137927 "Tomo man-pages"
.SH NAME
Path.glob \- 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 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.


.TS
allbox;
lb lb lbx lb
l l l l.
Name	Type	Description	Default
path	Path	The path of the directory which may contain special globbing characters like `*`, `?`, or `{...}` 	-
.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
>> (./*).glob()
= [(./foo.txt), (./baz.txt), (./qux.jpg)]

>> (./*.txt).glob()
= [(./foo.txt), (./baz.txt)]

>> (./*.{txt,jpg}).glob()
= [(./foo.txt), (./baz.txt), (./qux.jpg)]

>> (./.*).glob()
= [(./.hidden)]

# Globs with no matches return an empty list:
>> (./*.xxx).glob()
= []
.EE