A simple tool to track working hours by task via CLI.
Chmod + link the script:
chmod +x ./timetrack.py
sudo ln -s "$(pwd)/timetrack.py" /usr/local/bin/task
task status
: Show the currently running task: start time, duration, nametask start NAME
: Start a new task with the nameNAME
, abort with error if one is runningtask stop
: End the current tasktask log
: Mark all tasks logged up to including the last task that was ended and show all tasks who's status changedtask unlog
: Undo the last call totask log
task show {all, today, unlogged}
: Only show tasks that are from this day/unloggedtask print
: Pretty print the current week into${ARCHIVE_DIR}/KW_${XX}.md
+ stdout, whereXX
is the current calendar week.task push
: Upload unlogged files to Harvest
On each task
invocation:
- Print the current task + time running to a file for the OS statusbar
The following config parameters can be edited in the source directly:
TIMETRACK_DB = "timetrack.db"
STATUSBAR_FILE = "/tmp/task"
ARCHIVE_DIR = Path("/tmp")
TIMETRACK_DB
is the storage location of the SQLite database (make sure to use an absolute path).
STATUSBAR_FILE
is the file that gets an ultra-short stat on the current running task on each invocation.
ARCHIVE_DIR
is where task print
stores the weekly human-readable reports in Markdown format.
In order to successfully push to Harvest, you need to set 3 environment variables:
export [email protected]
export HARVEST_ACCOUNT_ID=1234
export HARVEST_TOKEN=1234
Read the API doc for more info.
Also, there are 2 more config variables that are currently hardcoded:
PROJECT_ID = 1
TASK_ID = 1
These IDs define to which project on Harvest the unlogged tasks are uploaded to.
- SQLite database
- Each task has unique UUID
Test Harvest integration.