aboutsummaryrefslogtreecommitdiff
path: root/wiki
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-01-09 20:39:42 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-01-09 20:39:42 +0100
commitbf0b452bd573cc81e802c8b43e3b4c920ad3cafc (patch)
treee0975ab2daace67c0bf292537db4ac7244042b88 /wiki
parentWed, 09 Jan 2019 20:37:04 +0100 (diff)
downloadwiki-public-bf0b452bd573cc81e802c8b43e3b4c920ad3cafc.tar.gz
wiki-public-bf0b452bd573cc81e802c8b43e3b4c920ad3cafc.tar.xz
Wed, 09 Jan 2019 20:39:42 +0100
Diffstat (limited to 'wiki')
-rwxr-xr-xwiki17
1 files changed, 16 insertions, 1 deletions
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 $@ &