-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
64 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,34 @@ | ||
# pounce | ||
simple find and replace in files | ||
|
||
simple find and replace in files. | ||
|
||
``` | ||
$ pounce collect -r -s 'dog' > /tmp/dogs.txt | ||
$ cat /tmp/dogs.txt | ||
README.md:1:I like dogs | ||
some/dir/dogs.txt:3:dogs are the best! | ||
$ # The idea is that this can be done interactively using vim. | ||
$ # This allows trial and error and faster feedback, but for | ||
$ # the sake of demo, we'll use sed. | ||
$ sed -i '' -e 's/dog/cat/g' /tmp/dogs.txt | ||
$ pounce apply < /tmp/dogs.txt | ||
$ cat README.md | ||
I like cats | ||
``` | ||
|
||
One liner version: | ||
``` | ||
$ pounce collect -r -s 'dog' | sed -e 's/dog/cat/g' | pounce apply | ||
``` | ||
|
||
# TODO | ||
|
||
[ ] deal with colons in file names. | ||
[ ] deal with no EOL last line. | ||
[ ] apply: only generate backup files if content actually changed. | ||
[ ] apply: read/write piece wise. | ||
[ ] \n vs \r\n? | ||
|
||
# Disclaimer | ||
|
||
Both cats and dogs are awesome. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,6 @@ import ( | |
var app = cli.App{ | ||
Commands: []*cli.Command{ | ||
&collectCmd, | ||
&replaceCmd, | ||
&applyCmd, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters