aboutsummaryrefslogtreecommitdiff
path: root/wiki
diff options
context:
space:
mode:
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 $@ &