repin

package module
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2022 License: MIT Imports: 5 Imported by: 4

README

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/repin@vX.X.X

manually:

Download binary from releases page

docker:

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pick added in v0.3.0

func Pick(src io.Reader, start, end string, nonl bool, out io.Writer) (int, error)

Pick strings between `start` and `end` of `src` and write `out`.

func Replace

func Replace(src, replace io.Reader, start, end string, nonl bool, out io.Writer) (int, error)

Replace strings between `start` and `end` of `src` to `replace` and write `out`.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL