Skip to content

Instantly share code, notes, and snippets.

@rcmdnk
Last active December 16, 2015 03:59
Show Gist options
  • Save rcmdnk/5373541 to your computer and use it in GitHub Desktop.
Save rcmdnk/5373541 to your computer and use it in GitHub Desktop.
Change agenda's format of gcalcli (https://github.com/insanum/gcalcli, v3.1) to fix for narrow space
diff --git a/gcalcli b/gcalcli
index f5cc390..c39bc84 100755
--- a/gcalcli
+++ b/gcalcli
@@ -1074,7 +1074,7 @@ class gcalcli:
new_descr += wrapper.fill(line) + "\n"
return new_descr.rstrip()
- indent = 10 * ' '
+ indent = ''
detailsIndent = 19 * ' '
if self.military:
@@ -1092,11 +1092,11 @@ class gcalcli:
PrintMsg(self.dateColor, prefix)
if event['s'].hour == 0 and event['s'].minute == 0 and \
event['e'].hour == 0 and event['e'].minute == 0:
- fmt = ' ' + timeFormat + ' %s\n'
+ fmt = ' %s\n'
PrintMsg(self._CalendarColor(event['gcalcli_cal']), fmt %
- ('', self._ValidTitle(event).strip()))
+ (self._ValidTitle(event).strip()))
else:
- fmt = ' ' + timeFormat + ' %s\n'
+ fmt = ' ' + timeFormat + ' %s\n'
# if 'summary' not in event:
# dprint(event)
PrintMsg(self._CalendarColor(event['gcalcli_cal']), fmt %
@@ -1318,7 +1318,7 @@ class gcalcli:
return
# 10 chars for day and length must match 'indent' in _PrintEvent
- dayFormat = '\n%F' if yearDate else '\n%a %b %d'
+ dayFormat = '%d(%a)/%b/%Y:\n'
day = ''
for event in eventList:
@@ -1500,6 +1500,17 @@ class gcalcli:
eventList = self._SearchForCalEvents(start, end, None)
+ # Remove duplications
+ events=[]
+ newEventList=[]
+ for e in eventList:
+ if e['summary'] not in events:
+ newEventList.append(e)
+ events.append(e['summary'])
+ eventList = newEventList
+
if self.tsv:
self._tsv(start, eventList)
else:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment