https://github.com/no-src/replacer
https://github.com/no-src/replacer
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/no-src/replacer
- Owner: no-src
- License: apache-2.0
- Created: 2023-11-02T19:16:59.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-11-25T01:35:51.000Z (7 months ago)
- Last Synced: 2025-11-28T11:52:19.163Z (7 months ago)
- Language: Go
- Size: 47.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# replacer
[](https://github.com/no-src/replacer/actions)
[](https://github.com/no-src/replacer/blob/main/LICENSE)
[](https://pkg.go.dev/github.com/no-src/replacer)
[](https://goreportcard.com/report/github.com/no-src/replacer)
[](https://codecov.io/gh/no-src/replacer)
[](https://github.com/no-src/replacer/releases)
The replacer is a configuration-based file replace tool.
## Installation
The first need [Go](https://go.dev/doc/install) installed (**version 1.21+ is required**), then you can use the below
command to install `replacer`.
```bash
go install github.com/no-src/replacer/...@latest
```
### Run In Docker
You can use the [build-docker.sh](/scripts/build-docker.sh) script to build the docker image and you should clone this
repository and `cd` to the root path of the repository first.
```bash
$ ./scripts/build-docker.sh
```
Or pull the docker image directly from [DockerHub](https://hub.docker.com/r/nosrc/replacer) with the command below.
```bash
$ docker pull nosrc/replacer
```
## Quick Start
Create a config file named `replacer.yaml`, content is as follows
```yaml
name: the configuration of replacer
version: v0.0.1
items:
- name: replace domain
paths:
- "*/test.yaml"
rules:
- old:
- 127.0.0.1:8888
- 127.0.0.1:9999
new:
test: test-github.com
uat: uat-github.com
product: product-github.com
```
Now running the command below start to replace the files.
```bash
$ replacer -root="./testdata/testfile" -tag=test
```