mirror of
https://codeberg.org/privacy1st/py-regex-replace
synced 2024-12-23 02:36:05 +01:00
70 lines
1.9 KiB
Markdown
70 lines
1.9 KiB
Markdown
# py-regex-replace
|
|
|
|
Perform regex-replacement on stdin and output result to stdout.
|
|
|
|
## Usage
|
|
|
|
```
|
|
usage: py-regex-replace [-h] --pattern PATTERN --repl REPL [--count COUNT]
|
|
|
|
options:
|
|
-h, --help show this help message and exit
|
|
--pattern PATTERN, -p PATTERN
|
|
regex search pattern
|
|
--repl REPL, -r REPL replacement
|
|
--count COUNT, -c COUNT
|
|
expected count of pattern in string. -1 allows any
|
|
count
|
|
```
|
|
|
|
```
|
|
usage: py-replace [-h] --text TEXT --repl REPL [--count COUNT]
|
|
|
|
options:
|
|
-h, --help show this help message and exit
|
|
--text TEXT, -t TEXT text to replace
|
|
--repl REPL, -r REPL replacement
|
|
--count COUNT, -c COUNT
|
|
expected count of text in string. -1 allows any
|
|
count
|
|
```
|
|
|
|
## Examples
|
|
|
|
Some small example scripts can be found in [./test](./test). They can be run from inside the test directory:
|
|
|
|
```shell
|
|
cd test
|
|
./test.sh
|
|
```
|
|
|
|
## Installation
|
|
|
|
```shell
|
|
make install
|
|
```
|
|
|
|
## Uploading to TestPyPI
|
|
|
|
More detailed instructions can be found at [https://packaging.python.org/tutorials/packaging-projects/](https://packaging.python.org/tutorials/packaging-projects/)
|
|
|
|
1) Set up a _venv_
|
|
2) Increase/Adjust `[metadata][version]` in [setup.cfg](setup.cfg)
|
|
3) Install the `build` and `twine` modules to your _venv_.
|
|
4) Next generate a [distribution archive](https://packaging.python.org/tutorials/packaging-projects/#generating-distribution-archives):
|
|
|
|
```shell
|
|
python3 -m build
|
|
```
|
|
|
|
5) Upload the distribution packages with twine. For the username, use `__token__`. For the password, use a
|
|
[test.pypi.org API token](https://test.pypi.org/manage/account/#api-tokens):
|
|
|
|
```shell
|
|
python3 -m twine upload --repository testpypi dist/*
|
|
```
|
|
|
|
6) Congratulations! You can view the uploaded module under:
|
|
|
|
* [https://test.pypi.org/project/py-regex-replace/](https://test.pypi.org/project/py-regex-replace/)
|