aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJuhani Krekelä2024-10-11 22:33:31 +0300
committerWolfgang Müller2024-10-26 19:24:09 +0200
commit90121061eb9cb42f07b15027e2a920841cfe4dfe (patch)
tree1bf053f30aa8244bafcd720982aedbc8a3e424c9
parent4edfbe1745587a54a7900e1528d3c95c6edceafb (diff)
downloadlater-90121061eb9cb42f07b15027e2a920841cfe4dfe.tar.gz
Pass title_map explicitly when formatting WatchLaterEntry
WatchLaterEntry's __str__ method implicitly depends on the title_map variable existing in the global scope. This makes the dependency on the title_map explicit.
-rwxr-xr-xlater4
1 files changed, 2 insertions, 2 deletions
diff --git a/later b/later
index 2f13872..5289f2d 100755
--- a/later
+++ b/later
@@ -42,7 +42,7 @@ class WatchLaterEntry:
path: str
mtime: dt
- def __str__(self):
+ def format(self, title_map):
def format_time(time):
now = dt.now()
if time < now - datetime.timedelta(days=7):
@@ -171,6 +171,6 @@ args = parser.parse_args()
title_map = TitleMap(title_map_file, update=args.update_titles)
for entry in entries():
- print(entry)
+ print(entry.format(title_map))
title_map.maybe_commit()