about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Doc/Zsh/calsys.yo8
-rw-r--r--Functions/Calendar/calendar18
3 files changed, 25 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 3960e0e3f..f3e6c5b0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-08-16  Peter Stephenson  <pws@csr.com>
+
+	* 23761: Doc/Zsh/calsys.yo, Functions/Calendar/calendar:
+	calendar -b shows brief output.
+
 2007-08-14  Peter Stephenson  <pws@csr.com>
 
 	* 23759: Doc/Zsh/contrib.yo, Functions/MIME/pick-web-browser:
diff --git a/Doc/Zsh/calsys.yo b/Doc/Zsh/calsys.yo
index f837a04fe..3b6551b07 100644
--- a/Doc/Zsh/calsys.yo
+++ b/Doc/Zsh/calsys.yo
@@ -309,8 +309,8 @@ subsect(Calendar system functions)
 
 startitem()
 findex(calendar)
-xitem(tt(calendar) [ tt(-adDsv) ] [ tt(-C) var(calfile) ] [ -n var(num) ] [ tt(-S) var(showprog) ] [ [ var(start) ] var(end) ])(
-item(tt(calendar -r) [ tt(-adDrsv) ] [ tt(-C) var(calfile) ] [ -n var(num) ] [ tt(-S) var(showprog) ] [ var(start) ])(
+xitem(tt(calendar) [ tt(-abdDsv) ] [ tt(-C) var(calfile) ] [ -n var(num) ] [ tt(-S) var(showprog) ] [ [ var(start) ] var(end) ])(
+item(tt(calendar -r) [ tt(-abdDrsv) ] [ tt(-C) var(calfile) ] [ -n var(num) ] [ tt(-S) var(showprog) ] [ var(start) ])(
 Show events in the calendar.
 
 With no arguments, show events from the start of today until the end of
@@ -342,6 +342,10 @@ item(tt(-a))(
 Show all items in the calendar, regardless of the tt(start) and
 tt(end).
 )
+item(tt(-b))(
+Brief:  don't display continuation lines (i.e. indented lines following
+the line with the date/time), just the first line.
+)
 item(tt(-C) var(calfile))(
 Explicitly specify a calendar file instead of the value of
 the tt(calendar-file) style or the the default tt(~/calendar).
diff --git a/Functions/Calendar/calendar b/Functions/Calendar/calendar
index b3cb58425..328da853c 100644
--- a/Functions/Calendar/calendar
+++ b/Functions/Calendar/calendar
@@ -1,11 +1,11 @@
 emulate -L zsh
 setopt extendedglob
 
-local line restline REPLY REPLY2 userange pruned nobackup datefmt
+local line showline restline REPLY REPLY2 userange pruned nobackup datefmt
 local calendar donefile sched newfile warnstr mywarnstr newdate
 integer time start stop today ndays y m d next=-1 shown done nodone
 integer verbose warntime mywarntime t tcalc tsched i rstat remaining
-integer showcount icount repeating repeattime resched showall
+integer showcount icount repeating repeattime resched showall brief
 local -a calendar_entries calendar_addlines
 local -a times calopts showprog lockfiles match mbegin mend
 
@@ -101,6 +101,11 @@ while [[ ${argv[opti+1]} = -* ]]; do
       (( showall = 1 ))
       ;;
 
+      (b)
+      # Brief: don't show continuation lines
+      (( brief = 1 ))
+      ;;
+
       (d)
       # Move out of date items to the done file.
       (( done = 1 ))
@@ -284,16 +289,21 @@ fi
       fi
     fi
     (( shown = 0 ))
+    if (( brief )); then
+      showline=${line%%$'\n'*}
+    else
+      showline=$line
+    fi
     if (( showall || (t >= start && (remaining || t <= stop || icount < showcount)) ))
     then
-      $showprog $start $stop "$line"
+      $showprog $start $stop "$showline"
       (( icount++ ))
       # Doesn't count as "shown" unless the event has now passed.
       (( t <= EPOCHSECONDS )) && (( shown = 1 ))
     elif [[ -n $sched ]]; then
       (( tsched = t - mywarntime ))
       if (( tsched >= start && tsched <= stop)); then
-	$showprog $start $stop "due in ${mywarnstr}: $line"
+	$showprog $start $stop "due in ${mywarnstr}: $showline"
       fi
     fi
     if [[ -n $sched ]]; then