Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/test_things_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def test_today(self):
finally:
sys.stdout = old_out
self.assertIn("To-Do in Today", new_out.getvalue())
self.assertIn("\n With\n Notes\n", new_out.getvalue())

def test_csv(self):
"""Test Next via CSV."""
Expand Down
11 changes: 7 additions & 4 deletions things_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ def txt_dumps(self, tasks, indentation="", result=""):
return result
for task in tasks:
title = task["title"]
notes = task.get("notes", "")
context = (
task.get("project_title", None)
or task.get("area_title", None)
Expand All @@ -214,11 +215,13 @@ def txt_dumps(self, tasks, indentation="", result=""):
start = task.get("start_date", None)
details = " | ".join(filter(None, [start, context]))
result = result + f"{indentation}- {title} ({details})\n"
result = self.txt_dumps(task.get("items", []), indentation + " ", result)
new_indentation = indentation + " "
if notes:
lines = [f"{new_indentation}{ln}\n" for ln in notes.split("\n")]
result += "".join(lines)
result = self.txt_dumps(task.get("items", []), new_indentation, result)
task.pop("items", [])
result = self.txt_dumps(
task.get("checklist", []), indentation + " ", result
)
result = self.txt_dumps(task.get("checklist", []), new_indentation, result)

return result

Expand Down