#sed #tool #command-line-tool #cli

app cli-rpx

Rpx is a tool to provide simple string replacement to GIT controled projects, it is a sed less powerfull but simpler

5 stable releases

1.1.1 Mar 12, 2024
1.0.2 Feb 27, 2024

#2 in #sed

Download history 275/week @ 2024-02-23 54/week @ 2024-03-01 192/week @ 2024-03-08 36/week @ 2024-03-15 6/week @ 2024-03-29 2/week @ 2024-04-05

181 downloads per month

MIT license

3MB
255 lines

Contains (ELF exe, 5MB) bin/rpx, (ELF exe/lib, 5MB) dist/rpx

Rpx (simple and extensible string replacer)

Rpx is a tool to provide simple string replacement to GIT controled projects, it is a sed less powerfull but simpler.

Motivation

Sometimes I wanted to perform some string replacement on several files, I used sed for this but even though it works perfectly I missed some features like:

  • Filtering only git files git ls-files.
  • Visual preview of changes.
  • Be able to cherry pick which files / lines would be changed.

So because this I decided to create my own tool for this.

Example

Installation

Just download the binary in bin/rpx and add it to the path

wget https://raw.githubusercontent.com/andrewaguiar/rpx/master/dist/rpx
chmod +x rpx

Or clone the project and make the binary

git clone git@github.com:andrewaguiar/rpx.git
cd rpx
./make_dist

Then add it to PATH

export PATH="$PATH:rpx_location/dist"

Usage

Type rpx to see instructions.

NAME
       rpx -- simple and powerfull string replacer based on non gitignore files

SYNOPSIS
       rpx <string-to-be-replaced> [replacement] [-f]

DESCRIPTION

       Rpx scans all git ls-files recursively and shows all occurences of <string-to-be-replaced> in each file, then it
       asks for confirmation before replace all occurrences by <replacement>.

       The following options are available:

       --filename | -f
              Filters by absolute path name in any part (defaults '').

              Example: "rpx AppController ApplicationController -f controllers" will consider only files with controllers
                       in absolute path like ("app/controllers/app_controllers.rb", "config/controllers.rb").

Creating a bin

run ./make_dist and the binary will be generated in ./dist.

Dependencies

~1–12MB
~89K SLoC