From bf0b452bd573cc81e802c8b43e3b4c920ad3cafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 9 Jan 2019 20:39:42 +0100 Subject: Wed, 09 Jan 2019 20:39:42 +0100 --- wiki | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'wiki') diff --git a/wiki b/wiki index a601da9..e37cbcc 100755 --- a/wiki +++ b/wiki @@ -8,6 +8,11 @@ WIKI_LIST=$(ls $WIKIROOT | grep -v html) wiki_list="" +# +# Adds all files to git, and commits with either the arguments as +# message, or with the current time as the message. +# Assumes that PWD is a git repo. +# function commit { if [ $# -eq 1 ]; then msg="$(date --rfc-email)" @@ -18,6 +23,9 @@ function commit { git commit -m "$msg" } +# +# Like commit above, but ammends +# function ammend { if [ $# -eq 1 ]; then git commit --amend @@ -27,6 +35,9 @@ function ammend { fi } +# +# Run function on wiki +# function wiki_do { wiki=$1 command=$2 @@ -58,6 +69,9 @@ function wiki_do { # == MAIN == +# +# Parse command line options +# while [ $# -ne 0 ]; do case $1 in -w|--wiki) @@ -97,13 +111,14 @@ while [ $# -ne 0 ]; do esac done - +# Edit the given wiki if no further argument is given if [ $# -eq 0 ]; then set -- ${wiki_list:-$WIKI_LIST} vim $WIKIROOT/$1/index.* exit fi +# Run given command for all wikis for wiki in ${wiki_list:-$WIKI_LIST}; do echo "== $wiki ==" wiki_do $wiki $@ & -- cgit v1.2.3