Skip to content

Commit 5e82a30

Browse files
committed
cli(search[docs]): Document search pattern fields
why: SearchToken is a NamedTuple, so an undocumented field reaches the API reference as "Alias for field number 0". what: - Add Attributes sections to SearchToken and SearchPattern - Record that fields carries the "field:" prefix scope and that raw holds the pattern before escaping or word-boundary wrapping
1 parent a0c5e6c commit 5e82a30

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/vcspull/cli/search.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,20 @@ class SearchToken(t.NamedTuple):
4848

4949
@dataclass(frozen=True)
5050
class SearchPattern:
51-
"""Compiled search pattern tied to repository fields."""
51+
"""Compiled search pattern tied to repository fields.
52+
53+
Attributes
54+
----------
55+
fields : tuple[str, ...]
56+
Canonical field names the regex is applied to, carried over from the
57+
token it was compiled from.
58+
raw : str
59+
Pattern text as typed, before ``--fixed-strings`` escaping or
60+
``--word-regexp`` boundary wrapping.
61+
regex : re.Pattern[str]
62+
Matcher compiled from ``raw``, case-insensitive when ``--ignore-case``
63+
was given or smart-case resolved that way.
64+
"""
5265

5366
fields: tuple[str, ...]
5467
raw: str

0 commit comments

Comments
 (0)