add --push option

This commit is contained in:
Motonori Iwata 2011-10-19 08:31:18 +09:00
parent e761daff73
commit 3c18d7cdb5
4 changed files with 16 additions and 9 deletions

View file

@ -15,7 +15,7 @@ __git-now-add ()
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments \
_arguments -s : \
'-n[do not actually add files; only show which ones would be added]'\
'-v[show files as they are added]'\
'-f[allow adding otherwise ignored files]'\
@ -103,7 +103,7 @@ case $state in
;;
(grep)
_arguments \
_arguments -s : \
'-p[generate diff in patch format]'\
'-s[generate diffstat instead of patch]'\
'-m[limit git-now commits by your name]'\

View file

@ -60,7 +60,7 @@ _git-now ()
;;
(grep)
_arguments \
_arguments -s : \
'-p[generate diff in patch format]'\
'-s[generate diffstat instead of patch]'\
'-m[limit git-now commits by your name]'\
@ -79,7 +79,7 @@ __git-now-add ()
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments \
_arguments -s : \
'-n[do not actually add files; only show which ones would be added]'\
'-v[show files as they are added]'\
'-f[allow adding otherwise ignored files]'\

View file

@ -1,8 +1,8 @@
usage() {
echo "usage: git now add [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]"
echo " [--edit | -e] [--all | [--update | -u]] [--intent-to-add | -N]"
echo " [--refresh] [--ignore-errors] [--ignore-missing] [ --stat | -s ] [--]"
echo " [<filepattern>...]"
echo " [--refresh] [--ignore-errors] [--ignore-missing] [--stat | -s] [--push]"
echo " [--] [<filepattern>...]"
}
cmd_default() {
@ -11,7 +11,9 @@ cmd_default() {
git add -u
printf "${MESSAGE}\n\n%s" "`git diff --cached`" | git commit -F -
else
local is_all=false
local is_stat=false
local is_push=false
local args=()
# args loop
@ -19,13 +21,17 @@ cmd_default() {
do
if [ $arg = "--stat" ] || [ $arg = "-s" ]; then
is_stat=true
elif [ $arg = "--all" ]; then
is_all=true
elif [ $arg = "--push" ]; then
is_push=true
else
n=${#args[@]}
args[$n]=$arg
fi
done
if [ $1 != "--all" ]; then
if ! $is_all; then
git add ${args[@]}
else
git add -u
@ -37,6 +43,7 @@ cmd_default() {
else
printf "${MESSAGE}\n\n%s" "`git diff --cached`" | git commit -F -
fi
$is_push && git push
fi
}

View file

@ -1,8 +1,8 @@
require 'formula'
class GitNow < Formula
url 'https://github.com/iwata/git-now.git', :tag => 'v0.1.0.1'
version '0.1.0.1'
url 'https://github.com/iwata/git-now.git', :tag => 'v0.1.0.2'
version '0.1.0.2'
head 'https://github.com/iwata/git-now.git', :branch => 'develop'
homepage 'https://github.com/iwata/git-now'