GitShow/sindresorhus/replace-in-files-cli
sindresorhus

replace-in-files-cli

Replace matching strings and regexes in files

by sindresorhus
cli-appcommand-line-toolnodejsnpm-packagereplacereplace-in-filesreplace-textsearch-and-replace
Star on GitHubForknpm

JavaScript

179 stars12 forks6 contributorsQuiet · 11mo agoSince 2019v4.0.0MIT

Meet the team

See all 6 on GitHub →
sindresorhus
sindresorhus22 contributions
boneskull
boneskull1 contribution
mesqueeb
mesqueeb1 contribution
Richienb
Richienb1 contribution
ritazoliveira
ritazoliveira1 contribution
rivy
rivy1 contribution

Languages

View on GitHub →
JavaScript100%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent fixes

View closed PRs →
boneskull
prepending / appending to file (API bikeshedding)ClosedIssue

I'm using (specifically, the programmatic API) to _prepend_ a banner to a bunch of files. There are myriad packages to do this sort of thing, but they either a) expect the data to be in , b) are plugins for a task runner like , c) unmaintained, or d) hopelessly broken and overengineered. If you have written a standalone tool to do this, please let me know! This is what "prepend to file" looks like: Whereas "append to file" looks like this: This isn't quite obvious. I had to play around with regexes to arrive at "append", which works _opposite_ of how I'd expect--I'd expect a banner after every line (which can be accomplished with ). Anyway. I'm thinking supporting and flags would be more user-friendly. But since it's not really a "replace" operation, maybe it's out-of-scope for this module? Providing sugar functions like or might be OK, except that a user may want to append/prepend _and_ find/replace in a single operation-- accepts an array, after all.

boneskull · 11mo ago
cbdeveloper
Is it possible to detect and replace double quoted strings ? Ex: "use strict";ClosedIssue

I guess my issue is related to double quote strings. index.js** I need to add a after the , so it will become: I'm trying to enclose the double quotes with single quotes: Is it something possible to do?

cbdeveloper · 11mo ago
madnight
Add dry run optionClosedIssue

If the dry run option is set, then no changes should happen, instead it should list all changes that would happen.

madnight · 11mo ago
Structured data for AI agents

Repository: sindresorhus/replace-in-files-cli. Description: Replace matching strings and regexes in files Stars: 179, Forks: 12. Primary language: JavaScript. Languages: JavaScript (100%). License: MIT. Topics: cli-app, command-line-tool, nodejs, npm-package, replace, replace-in-files, replace-text, search-and-replace. Latest release: v4.0.0 (11mo ago). Open PRs: 0, open issues: 0. Last activity: 11mo ago. Community health: 85%. Top contributors: sindresorhus, boneskull, mesqueeb, Richienb, ritazoliveira, rivy.

·@ofershap

Replace github.com with gitshow.dev