diff --git a/etc/_git-now b/etc/_git-now index 9b565f7..3217bd2 100644 --- a/etc/_git-now +++ b/etc/_git-now @@ -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]'\ diff --git a/etc/git-now-completion.zsh b/etc/git-now-completion.zsh index a1919b4..f46df74 100644 --- a/etc/git-now-completion.zsh +++ b/etc/git-now-completion.zsh @@ -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]'\ diff --git a/git-now-add b/git-now-add index 30ddd57..154155c 100644 --- a/git-now-add +++ b/git-now-add @@ -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 " [...]" + echo " [--refresh] [--ignore-errors] [--ignore-missing] [--stat | -s] [--push]" + echo " [--] [...]" } 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 } diff --git a/git-now.rb b/git-now.rb index 27ca6f9..44330b7 100644 --- a/git-now.rb +++ b/git-now.rb @@ -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'