An open API service indexing awesome lists of open source software.

https://github.com/staticaland/between


https://github.com/staticaland/between

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

# between

A CLI tool that replaces text between two markers in files.

## Installation

### Homebrew (macOS/Linux)

First, tap the repository:

```bash
brew tap staticaland/between
```

Then, install the cask:

```bash
brew install --cask between
```

### From Source

```bash
go build -o between
```

Or install directly:

```bash
go install
```

## Usage

### Basic Example

Replace content between default HTML-style markers:

```bash
between replace -f index.html --content "Updated content"
```

This finds `` and `` markers and replaces everything between them.

### Custom Markers

Use custom markers for different file types:

```bash
# YAML configuration
between replace -f config.yaml \
--start-marker "# BEGIN CONFIG" \
--end-marker "# END CONFIG" \
--content "database_url: postgres://localhost/mydb"

# Markdown documentation
between replace -f docs.md \
--start-marker "## Generated Content" \
--end-marker "## End Generated" \
--content "This section is automatically updated"
```

### Real-world Examples

Update API documentation:

```bash
between replace -f README.md \
--start-marker "" \
--end-marker "" \
--content "$(curl -s http://localhost:3000/api/docs)"
```

Update configuration from template:

```bash
between replace -f app.config \
--start-marker "# AUTO-GENERATED" \
--end-marker "# END AUTO-GENERATED" \
--content "$(cat config-template.txt)"
```

## Command Reference

```sh
between replace [flags]

Flags:
-f, --file string File to process (required)
--content string New content to insert (required)
--start-marker string Start marker (default "")
--end-marker string End marker (default "")
-h, --help help for replace
```