Skip to content

Commit 5d76bf6

Browse files
committed
Add rr alias for rexreplace
1 parent d3b8899 commit 5d76bf6

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
myfile
3+
*.log

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[![Build Status](https://travis-ci.org/mathiasrw/rexreplace.svg?branch=master)](https://travis-ci.org/mathiasrw/rexreplace)
2-
[![npm version](https://badge.fury.io/js/rexreplace.svg)](https://www.npmjs.com/package/rexreplace)
2+
[![npm](https://img.shields.io/npm/v/rexreplace.svg)](https://www.npmjs.com/package/rexreplace)
33

44
# RexReplace
55

@@ -10,7 +10,7 @@ backreference to matching groups in the replacement.
1010
Defaults to global multiline case-insensitive search.
1111
Needs node v6+.
1212

13-
Files can be given in [glob notation](https://www.tcl.tk/man/tcl8.5/tutorial/Tcl16a.html), for example the glob `docs/*.md` represents each markdown file in the `docs/` dir.
13+
Files can be given as [glob notation](https://www.tcl.tk/man/tcl8.5/tutorial/Tcl16a.html), for example the glob `docs/*.md` represents each markdown file in the `docs/` dir.
1414

1515
### Install
1616
```bash
@@ -22,6 +22,10 @@ Files can be given in [glob notation](https://www.tcl.tk/man/tcl8.5/tutorial/Tcl
2222
> rexreplace searchFor replaceWith fileA [fileB fileC ...]
2323
```
2424

25+
Hard on your fingers to write on your keyboard? We got you covered with `rr` as alias for `rexreplace`
26+
27+
28+
2529
### Examples
2630
```bash
2731
> rexreplace Foo xxx myfile.md
@@ -32,19 +36,18 @@ Files can be given in [glob notation](https://www.tcl.tk/man/tcl8.5/tutorial/Tcl
3236

3337
> rexreplace '^#' '##' *.md
3438
# All markdown files in this dir got all headlines moved one level deeper
35-
39+
3640
> rexreplace '(f?(o))o(.*)' '$3$1$2' myfile.md
3741
# 'foobar' in myfile.md will become 'barfoo'
3842

39-
# Some commandline tools (bash/zsh/...) is a bit funny with the `$` sign. use the '-€' flag to have `€` alias a `$`
40-
> rexreplace '(f?(o))o(.*)' '€3€1€2' myfile.md -€
43+
# Per default '€' is treated as an alias for '$' because some commandline tools have a special relationship with with the `$` char. Your can escape your way out of this old love story but it often popup in unexpected ways.
44+
> rexreplace '(f?(o))o(.*)' '€3€1€2' myfile.md
4145
# 'foobar' in myfile.md will become 'barfoo'
4246

4347
```
4448

4549

4650
### Options
47-
4851
```
4952
-v, --version Echo rexreplace version [boolean]
5053
-I, --void-ignore-case Void case insensitive search pattern. [boolean]
@@ -61,9 +64,8 @@ Files can be given in [glob notation](https://www.tcl.tk/man/tcl8.5/tutorial/Tcl
6164
-Q, --quiet-total Never display erros or info [boolean]
6265
-H, --halt Halt on first error [boolean] [default: false]
6366
-d, --debug Print debug info [boolean]
64-
-€, --eurodollar Replace all '€' with '$' in pattern and replace
65-
string. Usefull when your commandline (bash/zsh/...)
66-
seeks to do interesting things with '$' [boolean]
67+
-€, --void-euro Void having '€' as alias for '$' in pattern and
68+
replacement [boolean]
6769
-h, --help Show help [boolean]
6870
```
6971

@@ -75,6 +77,10 @@ All tests are defined in [test.sh](https://github.com/mathiasrw/rexreplace/blob/
7577
```
7678

7779
### Future ideas
80+
- Support node 0.12+
81+
- Test-run a with info outputted about what will happen (sets -v and does not change anything)
82+
- Let search and replace be withing the names of the files (ask for overwrite. -Y = no questions)
83+
- Let search and replace be within the path of the files (ask for overwrite. -Y = no questions)
7884
- Piped data while no globs = this is content to be searched (will always output) (when no -rp flags)
7985
- Piped data while having 1 globs = output is to be stored in this file (when no -rpo flags)
8086
- Piped data while having 2+ globs = error (when no -rpg flags)

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rexreplace",
3-
"version": "2.0.0",
3+
"version": "2.0.2",
44
"description": "CLI regexp replacement for files with lookahead and backreference to matching groups in the replacement.",
55
"author": "Mathias Rangel Wulff",
66
"license": "MIT",
@@ -10,7 +10,8 @@
1010
"url": "https://github.com/mathiasrw/rexreplace/"
1111
},
1212
"bin": {
13-
"rexreplace": "./rexreplace-cli.js"
13+
"rexreplace": "./rexreplace-cli.js",
14+
"rr": "./rexreplace-cli.js"
1415
},
1516
"scripts": {
1617
"test": "npm -g install ./ && bash test.sh",

rexreplace-cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22

3-
const version = `2.0.0`;
3+
const version = `2.0.1`;
44
const fs = require('fs');
55
const path = require('path');
66
const font = require('chalk');

0 commit comments

Comments
 (0)