Skip to content

Commit

Permalink
Add support of "pggit.sh grep" command.
Browse files Browse the repository at this point in the history
  • Loading branch information
MasaoFujii committed Jun 24, 2015
1 parent 81d15fc commit fd6d1a6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .pggit-completion.sh
Expand Up @@ -15,7 +15,7 @@ _pggit()
update|u)
WORDLIST="all";;
pggit.sh)
WORDLIST="apply branch co committer create diff help log make merge \
WORDLIST="apply branch co committer create diff grep help log make merge \
patch pull push remove rename reset untrack update wip";;
esac

Expand Down
47 changes: 26 additions & 21 deletions pggit.sh
Expand Up @@ -4,6 +4,7 @@

GITCMD=
ARGV1=
ARGV2=
SUPPORTED_VERS="9_4 9_3 9_2 9_1 9_0"

usage ()
Expand All @@ -15,25 +16,26 @@ Usage:
$PROGNAME [COMMAND]
Command:
apply PATCH creates new branch and applies PATCH
[b]ranch shows all local branches
co [PATTERN] moves to branch matching PATTERN (master branch by default)
committer shows how many patches each committer committed
create BRANCH creates new branch named BRANCH
diff [TARGET] shows changes between commits, commit and working tree, etc
help shows help message (default)
log [PATTERN] shows commit logs
make compiles and installs current branch into /dav/<branch-name>
merge updates master and merges it into current branch
patch [PATCH] creates patch with name PATCH against master in /dav
pull pulles current branch from github
push pushes current branch to github
remove [cascade] removes current branch (and its installation directory)
rename NAME renames current branch to NAME
reset [TARGET] resets current branch to HEAD (or TARGET)
untrack [clean] shows (or cleans up) all untracked objects
u[pdate] [all] updates master (and all supported versions)
wip commits current change with message "wip"
apply PATCH creates new branch and applies PATCH
[b]ranch shows all local branches
co [PATTERN] moves to branch matching PATTERN (master branch by default)
committer shows how many patches each committer committed
create BRANCH creates new branch named BRANCH
diff [TARGET] shows changes between commits, commit and working tree, etc
grep [-i] PATTERN prints lines matching PATTERN
help shows help message (default)
log [PATTERN] shows commit logs
make compiles and installs current branch into /dav/<branch-name>
merge updates master and merges it into current branch
patch [PATCH] creates patch with name PATCH against master in /dav
pull pulles current branch from github
push pushes current branch to github
remove [cascade] removes current branch (and its installation directory)
rename NAME renames current branch to NAME
reset [TARGET] resets current branch to HEAD (or TARGET)
untrack [clean] shows (or cleans up) all untracked objects
u[pdate] [all] updates master (and all supported versions)
wip commits current change with message "wip"
Move to branch matching COMMAND if it's not supported and there is branch
matching it.
Expand All @@ -45,13 +47,13 @@ while [ $# -gt 0 ]; do
"-?"|--help)
usage
exit 0;;
-*)
elog "invalid option: $1";;
*)
if [ -z "$GITCMD" ]; then
GITCMD="$1"
elif [ -z "$ARGV1" ]; then
ARGV1="$1"
elif [ -z "$ARGV2" ]; then
ARGV2="$1"
fi
;;
esac
Expand Down Expand Up @@ -138,6 +140,9 @@ elif [ "$GITCMD" = "diff" ]; then
DIFFTARGET="$ARGV1"
git diff $DIFFTARGET

elif [ "$GITCMD" = "grep" ]; then
git grep $ARGV1 $ARGV2

elif [ "$GITCMD" = "" -o "$GITCMD" = "help" ]; then
usage

Expand Down

0 comments on commit fd6d1a6

Please sign in to comment.