Permalink
Browse files

Improve documentation

  • Loading branch information...
1 parent e5089a3 commit a70a7c2f8302e7217c35be9b41907d30cf175614 @tobym committed Sep 19, 2012
Showing with 54 additions and 6 deletions.
  1. +26 −1 README.md
  2. +28 −5 pom
View
@@ -1,4 +1,29 @@
pom
===
-pom -- a minimalist pomodoro-style time-tracker
+a minimalist pomodoro-style time-tracker.
+
+synopsis
+--------
+
+ pom message [-l [logfile]]
+
+description
+-----------
+
+The pom utility counts down for 20 minutes as you work on a task. It will
+give an audible alert at 5 and 0 minutes if `say` is in the path and
+executable.
+
+-l [logfile]
+ If provided, log the completed task and timestamp to [logfile]. The
+ default is the POMLOG environment variable, if set. Otherwise, the
+ default is $HOME/pom.log.
+
+extras
+------
+
+1. Use `#hashtags` in your messages so you can easily grep for them later.
+2. Use `awk`/`grep` to add up time spent on projects, or for specific days.
+
+ awk '/#hacks/ { total += $1 } END { print total / 60 " hours" }' pom.log
View
33 pom
@@ -13,8 +13,8 @@
# executable.
#
# -l [logfile]
-# If provided, log the completed task and timestamp to _logfile_. The
-# default is the POMLOG environment variable, if set. Otherwise the
+# If provided, log the completed task and timestamp to [logfile]. The
+# default is the POMLOG environment variable, if set. Otherwise, the
# default is $HOME/pom.log.
#
# by @tobym (Toby Matejovsky) 2012-09-19.
@@ -62,9 +62,32 @@ function ring_bell {
which -s tput && tput bel
}
+# Print short version of help.
+function print_usage {
+ echo "Usage: $0 message [-l [logfile]]"
+}
+
# Print help.
function print_help {
- echo "Usage: $0 message [-l [logfile]]"
+ help_text='
+ NAME
+ pom -- a minimalist pomodoro-style time-tracker.
+
+ SYNOPSIS
+ pom message [-l [logfile]]
+
+ DESCRIPTION
+ The pom utility counts down for 20 minutes as you work on a task. It will
+ give an audible alert at 5 and 0 minutes if `say` is in the path and
+ executable.
+
+ -l [logfile]
+ If provided, log the completed task and timestamp to [logfile]. The
+ default is the POMLOG environment variable, if set. Otherwise, the
+ default is $HOME/pom.log.
+'
+
+ echo "$help_text"
}
# Main function.
@@ -96,10 +119,10 @@ then
print_help && exit 0
elif [ -z "$1" ]
then
- print_help && exit 1
+ print_usage && exit 1
elif [ ! -z "$2" ] && [ "$2" != "-l" ]
then
- print_help && exit 1
+ print_usage && exit 1
else
run_main
fi

0 comments on commit a70a7c2

Please sign in to comment.