From c3ad995c1ecf910e3a657293f9c8d4a614059f4f Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 14 May 2017 16:42:58 -0300 Subject: Make commit-updates work for any project we can cd into --- commit-updates | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'commit-updates') diff --git a/commit-updates b/commit-updates index 082727d..ab56b2e 100755 --- a/commit-updates +++ b/commit-updates @@ -4,20 +4,25 @@ # # Parameters +PROJECT="$1" + +# Check if param is a project +if [ ! -z "$PROJECT" ] && [ -z "$2" ] && ( cd $PROJECT &> /dev/null ); then + cd $PROJECT &> /dev/null + shift +fi + +# Commit message ARGS="$*" # Simply update commit if git status &> /dev/null; then - if [ ! -z "$1" ]; then - commit "Updates $*" + if [ ! -z "$ARGS" ]; then + commit "Updates $ARGS" else commit "Updates $(basename `pwd`)" fi else - if [ ! -z "$1" ] && [ -d "$1" ]; then - ( cd $1 &> /dev/null && commit "Updates $(basename $1)" ) - else - mr commit -m "Updates" - mr fetch - fi + mr commit -m "Updates" + mr fetch fi -- cgit v1.2.3