Skip to content

no-src/replacer

Repository files navigation

replacer

Build License Go Reference Go Report Card codecov Release

The replacer is a configuration-based file replace tool.

Installation

The first need Go installed (version 1.21+ is required), then you can use the below command to install replacer.

go install github.com/no-src/replacer/...@latest

Run In Docker

You can use the 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.

$ ./scripts/build-docker.sh

Or pull the docker image directly from DockerHub with the command below.

$ docker pull nosrc/replacer

Quick Start

Create a config file named replacer.yaml, content is as follows

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.

$ replacer -root="./testdata/testfile" -tag=test

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published