Skip to content

Commit

Permalink
release v7.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasrw committed Jul 28, 2023
1 parent 982a4db commit 6a3286b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 705 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ Flag | Effect
`-T` | **`--trim-pipe`** Trim piped data before processing. If piped data only consists of chars that can be trimmed (new line, space, tabs...) it will become an empty string. [boolean]
`-R` | **`--replacement-pipe`** Replacement will be piped in. You still need to provide a dummy value (like `_`) as replacement parameter. [boolean]
`-j` | **`--replacement-js`** Treat replacement as javascript source code. The statement from the last expression will become the replacement string. Purposefully implemented the most insecure way possible to remove _any_ incentive to consider running code from an untrusted part. The full match will be available as a javascript variable named $0 while each captured group will be available as $1, $2, $3, ... and so on. At some point, the $ char _will_ give you a headache when used from the command line, so use €0, €1, €2, €3... instead. If the javascript source code references to the full match or a captured group the code will run once per match. Otherwise, it will run once per file. The code has access to the following variables: `r` as an alias for `require` with both expanded to understand a relative path even if it is not starting with `./`, `fs` from node, `path` from node, `globs` from npm, `pipe`: the data piped into the command (null if no piped data), `find`: pattern searched for (the needle), `text`: full text being searched i.e. file content or piped data (the haystack), `bytes`: total size of the haystack in bytes, `size`: human-friendly representation of the total size of the haystack, `time`: String representing the local time when the command was invoked, `time_obj`: date object representing `time`, `now`: alias for `time`, `cwd`: current process working dir, `nl`: a new-line char, `_`: a single space char (for easy string concatenation). The following values defaults to `❌` if haystack does not originate from a file: `file`: contains the full path of the active file being searched (including full filename), `file_rel`: contains `file` relative to current process working dir, `dirpath`: contains the full path without filename of the active file being searched, `dirpath_rel`: contains `dirpath` relative to current process working dir, `filename`: is the full filename of the active file being searched without path, `name`: filename of the active file being searched with no extension, `ext`: extension of the filename including leading dot, `mtime`: ISO inspired representation of the last local modification time of the current file, `ctime`: ISO representation of the local creation time of the current file. `mtime_obj`: date object representing `mtime`, `ctime_obj`: date object representing `ctime`. All variables, except from module, date objects, `nl` and `_`, has a corresponding variable name followed by `_` where the content has an extra space at the end (for easy concatenation). [boolean]
`-x` | **`--exclude-re`** Exclude files with a path that matches this regular expression. Will follow same regex flags and setup as the main search. Can be used multiple times. [string]
`-X` | **`--exclude-glob`** Exclude files found with this glob. Can be used multiple times. [string]
`-h` | **`--help`** Display help. [boolean]
## Good to know
Expand Down
2 changes: 1 addition & 1 deletion bin/rexreplace.cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
byteOrSize: /bytes|size/,
folderName: /[\\\/]+([^\\\/]+)[\\\/]+[^\\\/]+$/,
};
var version = '7.1.2';
var version = '7.1.3';
function engine(config) {
if ( config === void 0 ) config = { engine: 'V8' };

Expand Down
Loading

0 comments on commit 6a3286b

Please sign in to comment.