Skip to main content

A simple CLI tool that repeats lines of text.

Project description

prayer-pause

A utility for repeating lines, or blocks of lines. Available as a CLI tool, a desktop GUI, and a Python package.

Features

  • Repeat each line (or a block of N lines) a configurable number of times
  • Insert a custom separator between each repetition of a line (--line-sep)
  • Insert a custom separator between each repeated block (--block-sep)
  • Three interfaces: CLI, GUI, and importable Python package
  • Handles edge cases: skips blank lines, strips trailing whitespace inconsistencies, validates input bounds

Installation

You can either get the pip package for CLI use. Or download the GUI app.

Standalone Executable

Download the latest .exe from the Releases page. No Python installation required.

Using pip

pip install line-repeater

Usage

GUI

  1. Launch line-repeater.exe.
  2. Paste (or type) your text into the text box, fill in the parameters, and click Run. The result replaces the content in the text box in place.

Parameters:

Field Description Default
Repeat N times How many times to repeat each line/block
Till line Size of each block of lines to repeat together 1
Block separator String inserted between each repeated block \n
Line separator String inserted between each repetition within a block None

CLI

lr <file> <repeat_n_times> [OPTIONS]

Arguments:

Argument Description
file Path to the file to modify (edited in place)
repeat_n_times How many times to repeat each line or block

Options:

Option Short Description Default
--till-line -tl Repeat blocks of N lines at a time 1
--block-sep -bs Separator between each repeated block \n
--line-sep -ls Separator inserted between each repetition None

Examples:

Repeat every line 3 times:

lr input.txt 3

Repeat every line 3 times, separated by a --- divider:

lr input.txt 3 --line-sep "---"

Repeat blocks of 2 lines, 4 times each, with a === block separator:

lr input.txt 4 --till-line 2 --block-sep "==="

API

The repeater function can be imported and used directly in your code.

from line_repeater import repeater

with open("file.txt", "r+") as f:
    repeater(
        file=f,                 # File-like object opened in read+write mode
        repeat_n_times=3,       # int - how many times to repeat each line/block
        till_line=1,            # int - block size (number of lines per block)
        block_line_sep="\n",    # str - separator between blocks
        line_sep="---",         # str | None - separator between repetitions
    )

Note: repeater() modifies the file in-place. Make sure to open it in r+ mode.

Exceptions:

Exception Condition
ValueError File/buffer is empty
ValueError till_line exceeds the number of lines in the file

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

line_repeater-1.1.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

line_repeater-1.1.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file line_repeater-1.1.1.tar.gz.

File metadata

  • Download URL: line_repeater-1.1.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for line_repeater-1.1.1.tar.gz
Algorithm Hash digest
SHA256 c4fefe32da1d573ab0dd4dc6ba1f70534b0794a246dfb65f8b8261403194ec05
MD5 c0ef0482308cb230bdc8996f57bdd760
BLAKE2b-256 ccae210d513d58969f6112f022558de58c6b95f8199fa177bb47e90389e73805

See more details on using hashes here.

File details

Details for the file line_repeater-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: line_repeater-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for line_repeater-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bb0ec3cbed7c9db2f9fd2c0b3730014e5294c0eb1ea1e2db2d0929315f36bb97
MD5 34115ba886b5645235664e428018f919
BLAKE2b-256 1a04e18e3f1786c2438c1837a4b83e9d9ca39890ceeb2aceca1cb08ddbd3dfe6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page