]> git.donarmstrong.com Git - bin.git/blob - update_org_files
add mutt alias which executes neomutt if that exists
[bin.git] / update_org_files
1 #!/bin/bash
2
3 ORG_GREP='-e .org$ -e .org_archive$ -e .org_done$'
4
5 COMMIT_MESSAGE="${1:-update org files}"
6
7 if [ "x$UPDATE_ORG_REALLY_DO_IT" == "xyesdoit" ]; then
8     if git status --porcelain -z | grep -z '^ M' | grep -zq $ORG_GREP; then
9         git status --porcelain -z | grep -z '^ M' | grep -z $ORG_GREP | \
10             sed -z 's/^ M[[:space:]]*//g' | \
11             xargs -0 git commit -m"$COMMIT_MESSAGE"
12         git push;
13     fi;
14     git pull;
15 else
16     emacsclient -n -e '(org-save-all-org-buffers)' >/dev/null 2>&1
17     UPDATE_ORG_REALLY_DO_IT="yesdoit" mr -d ~/projects/org-notes -j5 run \
18                            update_org_files "$COMMIT_MESSAGE"
19     UPDATE_ORG_REALLY_DO_IT="yesdoit" mr -d ~/org-mode -j5 run \
20                            update_org_files "$COMMIT_MESSAGE";
21 fi;