claude fixoval /remind skill
This commit is contained in:
@@ -143,28 +143,41 @@ def cmd_list(_args: argparse.Namespace) -> int:
|
||||
rows = conn.execute(
|
||||
"SELECT id, text, enabled, timezone, created_at, updated_at, deleted_at FROM reminders WHERE deleted_at IS NULL ORDER BY id"
|
||||
).fetchall()
|
||||
reminders = []
|
||||
for row in rows:
|
||||
if not rows:
|
||||
return 0
|
||||
|
||||
for idx, row in enumerate(rows, start=1):
|
||||
reminder = dict(row)
|
||||
rid = reminder["id"]
|
||||
reminder["at"] = [
|
||||
dict(r) for r in conn.execute(
|
||||
"SELECT id, at_datetime FROM schedule_at WHERE reminder_id = ?", (rid,)
|
||||
).fetchall()
|
||||
]
|
||||
reminder["cron"] = [
|
||||
dict(r) for r in conn.execute(
|
||||
"SELECT id, cron_expr FROM schedule_cron WHERE reminder_id = ?", (rid,)
|
||||
).fetchall()
|
||||
]
|
||||
reminder["random"] = [
|
||||
dict(r) for r in conn.execute(
|
||||
"SELECT id, times_per_day, window_start, window_end, days_filter, from_date, until_date FROM schedule_random WHERE reminder_id = ?",
|
||||
(rid,),
|
||||
).fetchall()
|
||||
]
|
||||
reminders.append(reminder)
|
||||
print(json.dumps({"reminders": reminders}, ensure_ascii=False))
|
||||
status = "enabled" if reminder["enabled"] else "disabled"
|
||||
print(f"{idx}. {reminder['text']} ({status})")
|
||||
|
||||
at_rows = conn.execute(
|
||||
"SELECT at_datetime FROM schedule_at WHERE reminder_id = ?", (rid,)
|
||||
).fetchall()
|
||||
for r in at_rows:
|
||||
print(f" - at: {r['at_datetime']}")
|
||||
|
||||
cron_rows = conn.execute(
|
||||
"SELECT cron_expr FROM schedule_cron WHERE reminder_id = ?", (rid,)
|
||||
).fetchall()
|
||||
for r in cron_rows:
|
||||
print(f" - cron: {r['cron_expr']}")
|
||||
|
||||
random_rows = conn.execute(
|
||||
"SELECT times_per_day, window_start, window_end, days_filter, from_date, until_date FROM schedule_random WHERE reminder_id = ?",
|
||||
(rid,),
|
||||
).fetchall()
|
||||
for r in random_rows:
|
||||
parts = [f"random: {r['times_per_day']}× daily {r['window_start']}–{r['window_end']}"]
|
||||
if r["days_filter"]:
|
||||
parts.append(f"({r['days_filter']})")
|
||||
if r["from_date"]:
|
||||
parts.append(f"from {r['from_date']}")
|
||||
if r["until_date"]:
|
||||
parts.append(f"until {r['until_date']}")
|
||||
print(f" - {' '.join(parts)}")
|
||||
|
||||
return 0
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
Reference in New Issue
Block a user