Skip to content

Commit 8482e99

Browse files
committed
Document quote handling in shell commands
Fixes #13
1 parent 4e07ca1 commit 8482e99

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

cli.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ const cli = meow(`
2323
$ replace-in-files --dry-run --string='old' --replacement='new' file.txt
2424
2525
You can use the same replacement patterns as with \`String#replace()\`, like \`$&\`.
26+
27+
When working with quotes in shell commands, escape them with backslashes:
28+
$ replace-in-files --string='\\"use strict\\";' --replacement='\\"use strict\\";\\nrequire(\\"module\\");' file.js
2629
`, {
2730
importMeta: import.meta,
2831
flags: {

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ $ replace-in-files --help
3131
$ replace-in-files --dry-run --string='old' --replacement='new' file.txt
3232
3333
You can use the same replacement patterns as with `String#replace()`, like `$&`.
34+
35+
When working with quotes in shell commands, escape them with backslashes:
36+
$ replace-in-files --string='\"use strict\";' --replacement='\"use strict\";\nrequire(\"module\");' file.js
3437
```
3538

3639
Real-world use-case: [Bumping version number in a file when publishing to npm](https://github.com/sindresorhus/modern-normalize/commit/c1d65e3f7daba2b695ccf837d2aef19d586d1ca6)

0 commit comments

Comments
 (0)