Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed conflict

  • Loading branch information...
commit 525092dffea2f1e9505bcba5bebc3b0cdb4b519e 2 parents 9e1d365 + 630e6d8
@logaritmisk logaritmisk authored
Showing with 36 additions and 14 deletions.
  1. +6 −0 README.md
  2. +30 −14 git-dude
View
6 README.md
@@ -99,6 +99,12 @@ Set path to icon used by desktop notifications (default: none):
$ git config --global dude.icon ~/.git-dude/github_32.png
+Set custom notification command (`$TITLE`, `$DESCRIPTION` and `$ICON_PATH`
+environment variables are set when invoking notification command):
+
+ $ git config --global dude.notify-command 'gntp-send "$TITLE" "$DESCRIPTION" "$ICON_PATH"'
+ $ git config --global dude.notify-command 'echo -e "$TITLE\n\n\n$DESCRIPTION" | espeak --stdin -k20 -ven+12'
+
### Per-repository
Set path to icon used by desktop notifications for this repository (default:
View
44 git-dude
@@ -20,27 +20,43 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Distributed under the GNU General Public License, version 2.0.
-interval=$(git config dude.interval)
-interval=${interval:-60}
+set -e
+interval=$(git config dude.interval || true)
+interval=${interval:-60}
app_name=$(basename $0)
export LC_ALL=C # make sure git talks english
-[[ -d $1 ]] && cd $1
+if [[ $(git config dude.notify-command) ]]; then
+ notify_cmd=$(git config dude.notify-command)
+elif [ $(which notify-send 2>/dev/null) ]; then
+ notify_cmd='notify-send -i "$ICON_PATH" "$TITLE" "$DESCRIPTION"'
+elif [ $(which growlnotify 2>/dev/null) ]; then
+ notify_cmd='growlnotify -n "$app_name" --image "$ICON_PATH" -m "$DESCRIPTION" "$TITLE"'
+elif [ $(which kdialog 2>/dev/null) ]; then
+ notify_cmd='kdialog --icon $ICON_PATH --title "$TITLE" --passivepopup "$DESCRIPTION"'
+fi
function notify() {
- if [ $(which notify-send 2>/dev/null) ]; then
- notify-send -i "$1" "$2" "$3"
- elif [ $(which growlnotify 2>/dev/null) ]; then
- growlnotify -n "$app_name" --image "$1" -m "$3" "$2"
- elif [ $(which kdialog 2>/dev/null) ]; then
- kdialog --icon $1 --title "$2" --passivepopup "$3"
- else
- echo $2; echo $3
+ local ICON_PATH="$1"
+ local TITLE="$2"
+ local DESCRIPTION="$3"
+
+ if [ -n "$notify_cmd" ]; then
+ eval $notify_cmd
fi
+
+ date "+%T %D"
+ echo "$TITLE"
+ if [ -n "$DESCRIPTION" ]; then
+ echo "$DESCRIPTION"
+ fi
+ echo
}
+[[ -d "$1" ]] && cd $1
+
while true; do
for dir_name in *; do
if [[ -d "$dir_name" && $(cd "$dir_name"; git rev-parse --git-dir 2>/dev/null) ]]; then
@@ -54,7 +70,7 @@ while true; do
changes=$(git fetch 2>&1 | grep -F -- '->' | sed -E 's/^\s+\+\s+//')
- icon_path=$(git config dude.icon)
+ icon_path=$(git config dude.icon || true)
icon_path=${icon_path:-`pwd`/icon.png}
eval icon_path=$icon_path # to expand ~
@@ -68,11 +84,11 @@ while true; do
;;
*new\ branch*)
branch_name=$(echo "$line" | awk '{ print $4 }')
- notify $icon_path "New branch $repo_name/$branch_name"
+ notify $icon_path "New branch $repo_name/$branch_name" ""
;;
*new\ tag*)
tag_name=$(echo "$line" | awk '{ print $4 }')
- notify $icon_path "New tag $repo_name/$tag_name"
+ notify $icon_path "New tag $repo_name/$tag_name" ""
;;
esac
done <<< "$changes"
Please sign in to comment.
Something went wrong with that request. Please try again.