Skip to content
/ repin Public

repin is a tool to replace strings between keyword pair.

License

Notifications You must be signed in to change notification settings

k1LoW/repin

Repository files navigation

repin build Go Reference Coverage Code to Test Ratio Test Execution Time

repin is a tool to replace strings between keyword pair.

tl;dr

repin is a tool that makes it easy to write operations that can be written in GNU sed as follows.

$ cat README.md
# Hello

```console
```

$ cat README.md | sed -z 's/```console.*```/```console\n$ echo hello world!\n```/'
# Hello

```console
$ echo hello world!
```

$
$ repin README.md -k '```console' -k '```' -r '$ echo hello world!'
# Hello

```console
$ echo hello world!
```

$
$ repin --help | repin README.md -k '```console' -k '```'
# Hello

```console
repin is a tool to replace strings between keyword pair.

Usage:
  repin [FILE] [flags]

Flags:
  -h, --help              help for repin
  -i, --in-place          edit file in place
  -k, --keyword strings   keywords to use as a delimiter. If 1 keyword is specified, it will be used as the start and end delimiters; if 2 keywords are specified, they will be used as the start and end delimiters, respectively.
  -N, --no-newline        disable appending newlines
      --raw-keywords      do not convert \n or \t of the entered keywords
  -r, --replace string    replace file path or string
  -v, --version           version for repin

```

Install

deb:

$ export REPIN_VERSION=X.X.X
$ curl -o repin.deb -L https://github.com/k1LoW/repin/releases/download/v$REPIN_VERSION/repin_$REPIN_VERSION-1_amd64.deb
$ dpkg -i repin.deb

RPM:

$ export REPIN_VERSION=X.X.X
$ yum install https://github.com/k1LoW/repin/releases/download/v$REPIN_VERSION/repin_$REPIN_VERSION-1_amd64.rpm

apk:

$ export REPIN_VERSION=X.X.X
$ curl -o repin.apk -L https://github.com/k1LoW/repin/releases/download/v$REPIN_VERSION/repin_$REPIN_VERSION-1_amd64.apk
$ apk add repin.apk

homebrew tap:

$ brew install k1LoW/tap/repin

go install:

$ go install github.com/k1LoW/repin/cmd/[email protected]

manually:

Download binary from releases page

docker:

$ docker pull ghcr.io/k1low/repin:latest