Skip to content

Commit

Permalink
#185: Add pattern example to README
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Jun 26, 2024
1 parent ae00d3a commit 53fd127
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,14 @@ In your pyproject.toml file, you may configure the following options:
poetry run python -c "import dunamai; print(dunamai.Pattern.Default.regex())"
```

Remember that backslashes must be escaped (`\\`) in the TOML file.
Remember that backslashes must be escaped in the TOML file.

```toml
# Regular expression:
pattern = '(?P<base>\d+\.\d+\.\d+)'
# Named preset:
pattern = "default-unprefixed"
```
* `pattern-prefix` (string):
This will be inserted after the pattern's start anchor (`^`).
For example, to match tags like `some-package-v1.2.3`,
Expand Down Expand Up @@ -249,12 +256,12 @@ In your pyproject.toml file, you may configure the following options:

```toml
patterns = [
"(^__version__\\s*(?::.*?)?=\\s*['\"])[^'\"]*(['\"])",
{ value = "(^__version_tuple__\\s*(?::.*?)?=\\s*\\()[^)]*(\\))", mode = "tuple" },
'''(^__version__\s*(?::.*?)?=\s*['"])[^'"]*(['"])''',
{ value = '''(^__version_tuple__\s*(?::.*?)?=\s*\()[^)]*(\))''', mode = "tuple" },
]
```

Remember that the backslashes must be escaped (`\\`) in the TOML file.
Remember that the backslashes must be escaped in the TOML file.
* `folders` (array of tables, default: empty):
List of additional folders to check for substitutions.

Expand Down

0 comments on commit 53fd127

Please sign in to comment.