* PATCH: calendar -b
@ 2007-08-16 9:24 Peter Stephenson
0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2007-08-16 9:24 UTC (permalink / raw)
To: Zsh hackers list
Minor tweak to "calendar" to add an option for brief output.
Index: Doc/Zsh/calsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/calsys.yo,v
retrieving revision 1.8
diff -u -r1.8 calsys.yo
--- Doc/Zsh/calsys.yo 26 Mar 2007 14:33:33 -0000 1.8
+++ Doc/Zsh/calsys.yo 16 Aug 2007 09:23:06 -0000
@@ -309,8 +309,8 @@
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 @@
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).
Index: Functions/Calendar/calendar
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Calendar/calendar,v
retrieving revision 1.4
diff -u -r1.4 calendar
--- Functions/Calendar/calendar 14 Jun 2007 13:25:58 -0000 1.4
+++ Functions/Calendar/calendar 16 Aug 2007 09:23:06 -0000
@@ -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 @@
(( 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
(( 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
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-08-16 9:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-16 9:24 PATCH: calendar -b Peter Stephenson
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).