Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
e294c590
Commit
e294c590
authored
Oct 30, 2015
by
Jacek Sowiński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement relative dates in list-format
parent
3a8e8efa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
4 deletions
+12
-4
setup.py
setup.py
+1
-0
topydo/lib/ListFormat.py
topydo/lib/ListFormat.py
+7
-0
topydo/lib/PrettyPrinterFilter.py
topydo/lib/PrettyPrinterFilter.py
+4
-4
No files found.
setup.py
View file @
e294c590
...
...
@@ -31,6 +31,7 @@ setup(
url
=
"https://github.com/bram85/topydo"
,
install_requires
=
[
'six >= 1.9.0'
,
'arrow'
,
],
extras_require
=
{
':sys_platform=="win32"'
:
[
'colorama>=0.2.5'
],
...
...
topydo/lib/ListFormat.py
View file @
e294c590
...
...
@@ -16,9 +16,16 @@
""" Ulities for formatting output with "list_format" option."""
import
arrow
def
filler
(
p_str
,
p_len
):
"""
Returns p_str preceded by additional spaces if p_str is shorter than p_len.
"""
to_fill
=
p_len
-
len
(
p_str
)
return
to_fill
*
' '
+
p_str
def
humanize_date
(
p_datetime
):
now
=
arrow
.
now
()
date
=
now
.
replace
(
day
=
p_datetime
.
day
,
month
=
p_datetime
.
month
,
year
=
p_datetime
.
year
)
return
date
.
humanize
()
topydo/lib/PrettyPrinterFilter.py
View file @
e294c590
...
...
@@ -22,7 +22,7 @@ from six import u
from
topydo.lib.Colors
import
NEUTRAL_COLOR
,
Colors
from
topydo.lib.Config
import
config
from
topydo.lib.ListFormat
import
filler
from
topydo.lib.ListFormat
import
filler
,
humanize_date
class
PrettyPrinterFilter
(
object
):
...
...
@@ -140,13 +140,13 @@ class PrettyPrinterFormatFilter(PrettyPrinterFilter):
'c': lambda t: t.creation_date().isoformat() if t.creation_date() else '',
# relative creation date
'C': lambda t:
'#', # TODO: humanized creation date
'C': lambda t:
humanize_date(t.creation_date()) if t.creation_date() else '',
# absolute due date
'd': lambda t: t.due_date().isoformat() if t.due_date() else '',
# relative due date
'D': lambda t:
'#', # TODO: humanized due date
'D': lambda t:
humanize_date(t.due_date()) if t.due_date() else '',
# todo ID
'i': lambda t: str(self.todolist.number(t)),
...
...
@@ -168,7 +168,7 @@ class PrettyPrinterFormatFilter(PrettyPrinterFilter):
't': lambda t: t.start_date().isoformat() if t.start_date() else '',
# relative start date
'T': lambda t:
'#', # TODO: humanized start date
'T': lambda t:
humanize_date(t.start_date()) if t.start_date() else '',
# literal %
'%': lambda _: '%',
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment