summary refs log tree commit diff
path: root/Functions/Calendar
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-08-16 09:31:47 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-08-16 09:31:47 +0000
commit1a4e80df1b4958873ef6959891ddde2533868a40 (patch)
tree3ca20ca3bf88c7df933cb7228df1231d68524a0c /Functions/Calendar
parent91d714752c382256b5f50d7f7fa5346d91e0a536 (diff)
downloadzsh-1a4e80df1b4958873ef6959891ddde2533868a40.tar.gz
zsh-1a4e80df1b4958873ef6959891ddde2533868a40.tar.xz
zsh-1a4e80df1b4958873ef6959891ddde2533868a40.zip
23761: calendar -b shows brief output
Diffstat (limited to 'Functions/Calendar')
-rw-r--r--Functions/Calendar/calendar18
1 files changed, 14 insertions, 4 deletions
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