-short becomes --short

This commit is contained in:
Manuel Ebert 2013-11-03 20:00:56 -08:00
parent e44240287e
commit 1e9fe2cf1e
3 changed files with 31 additions and 18 deletions

View file

@ -161,9 +161,12 @@ class Journal(object):
return entries
def __unicode__(self):
return self.pprint()
def pprint(self, short=False):
"""Prettyprints the journal's entries"""
sep = "\n"
pp = sep.join([e.pprint() for e in self.entries])
pp = sep.join([e.pprint(short=short) for e in self.entries])
if self.config['highlight']: # highlight tags
if self.search_tags:
for tag in self.search_tags:
@ -177,9 +180,6 @@ class Journal(object):
pp)
return pp
def pprint(self):
return self.__unicode__()
def __repr__(self):
return "<Journal with {0} entries>".format(len(self.entries))
@ -254,7 +254,13 @@ class Journal(object):
date, flag = self.dateparse.parse(date)
if not flag: # Oops, unparsable.
return None
try: # Try and parse this as a single year
year = int(date_str)
return datetime(year, 1, 1)
except ValueError:
return None
except TypeError:
return None
if flag is 1: # Date found, but no time. Use the default time.
date = datetime(*date[:3], hour=self.config['default_hour'], minute=self.config['default_minute'])