Skip to content

Instantly share code, notes, and snippets.

@AceofSpades5757
Created June 26, 2024 15:38
Show Gist options
  • Save AceofSpades5757/c6b13024458c0b93be874c195158c9f5 to your computer and use it in GitHub Desktop.
Save AceofSpades5757/c6b13024458c0b93be874c195158c9f5 to your computer and use it in GitHub Desktop.
IPython Profile for Taskwarrior
"""Startup files for my IPython Taskwarrior profile.
File is located in ~/.ipython/profile_task/startup
Script is run when running `ipython --profile task`
"""
import platform
from tasklib import TaskWarrior
from tasklib import Task
task_command: str
if platform.system() == "Windows":
task_command = "wsl task"
elif platform.system() == "Linux":
task_command = "task"
else:
raise NotImplementedError(f"Unsupported platform: {platform.system()}")
# == Load Common Tasks ==
tw = TaskWarrior(task_command=task_command)
all_ = tw.tasks.all()
pending = tw.tasks.pending()
completed = tw.tasks.completed()
deleted = tw.tasks.deleted()
waiting = tw.tasks.filter(status="waiting")
recurring = tw.tasks.filter(status="recurring")
# == Load Specialized Tasks ==
# Used to track my shifts at work (requires Taskwarrior plugin to save start data and set UDA elapsed time)
shifts = tw.tasks.filter(description__startswith="SHIFT")
# == Print Help ==
# * This help
# * Taskwarrior instance
# * Helper instances, like all_, pending, completed, deleted, waiting, recurring
print(help_ := """
Help Message : help_
Taskwarrior Instance: tw
Common Tasks
------------
All Tasks : all_
Pending Tasks : pending
Completed Tasks : completed
Deleted Tasks : deleted
Waiting Tasks : waiting
Recurring Tasks : recurring
Specialized Tasks
-----------------
Shift Tasks : shifts
""")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment