diff --git a/bin/git-sed b/bin/git-sed index 9ba4f81..a18fc36 100755 --- a/bin/git-sed +++ b/bin/git-sed @@ -2,10 +2,10 @@ usage() { cat < ] +usage: git sed [ -c ] [ -f ] [ ] Run git grep and then send results to sed for replacement with the -given flags, if -f is provided. +given flags, if they are provided via -f or as the third argument. Also runs git commit if -c is provided. EOF @@ -54,6 +54,8 @@ actual command: search="$1" elif [ "X$replacement" = "X" ]; then replacement="$1" + elif [ "X$flags" = "X" ]; then + flags="$1" else usage echo "too many arguments: $1" diff --git a/man/git-sed.md b/man/git-sed.md index 19d1f48..844c2af 100644 --- a/man/git-sed.md +++ b/man/git-sed.md @@ -3,12 +3,12 @@ git-sed(1) -- replace patterns in git-controlled files ## SYNOPSIS -`git-sed` [ -c ] [ -f ] +`git-sed` [ -c ] [ -f ] [ ] ## DESCRIPTION Run git grep and then send results to sed for replacement with the -given flags, if -f is provided. +given flags, if they are provided via -f or as the third argument. Also runs git commit if -c is provided. @@ -20,6 +20,7 @@ Also runs git commit if -c is provided. detailing the exact command ran. will fail if there are unstaged changes. + <flags> -f <flags> will use the given regex flags in the sed command (for example "g"