update documentation

This commit is contained in:
Manuel Barkhau 2019-02-22 10:40:31 +01:00
parent 98e97fa38a
commit cccd7052b8
2 changed files with 15 additions and 2 deletions

View file

@ -147,7 +147,7 @@ src/mymodule_v*/__init__.py =
__version__ = "{pycalver}" __version__ = "{pycalver}"
README.md = README.md =
[PyCalVer {calver}{build}{release}] [PyCalVer {calver}{build}{release}]
img.shields.io/badge/PyCalVer-{calver}{build}-{release}-blue img.shields.io/static/v1.svg?label=PyCalVer&message={pycalver}&color=blue
``` ```
To see if a pattern is found, you can use `pycalver bump --dry`, which will To see if a pattern is found, you can use `pycalver bump --dry`, which will
@ -188,6 +188,19 @@ INFO - New Version: v201902.0002-beta
license="MIT", license="MIT",
``` ```
If there is no match for a pattern, bump will report an error.
```shell
$ pycalver bump --dry --no-fetch
INFO - Old Version: v201901.0001-beta
INFO - New Version: v201902.0002-beta
ERROR - No match for pattern 'img.shields.io/static/v1.svg?label=PyCalVer&message={pycalver}&color=blue'
ERROR - Pattern compiles to regex 'img\.shields\.io/static/v1\.svg\?label=PyCalVer&message=(?P<pycalver>v(?P<year>\d{4})(?P<month>(?:0[0-9]|1[0-2]))\.(?P<bid>\d{4,})(?:-(?P
<tag>(?:alpha|beta|dev|rc|post|final)))?)&color=blue'
```
The internally used regular expression is also shown, which you can use to debug the issue, for example on https://regex101.com.
### Pattern Search and Replacement ### Pattern Search and Replacement

View file

@ -72,7 +72,7 @@ def rewrite_lines(
log.error(f"No match for pattern '{non_matched_pattern}'") log.error(f"No match for pattern '{non_matched_pattern}'")
compiled_pattern = patterns._compile_pattern(non_matched_pattern) compiled_pattern = patterns._compile_pattern(non_matched_pattern)
log.error(f"Pattern compiles to regex '{compiled_pattern}'") log.error(f"Pattern compiles to regex '{compiled_pattern}'")
raise ValueError("Invalid pattern(s)", list(non_matched_patterns)) raise ValueError("Invalid pattern(s)")
else: else:
return new_lines return new_lines