Skip to content

feat: allow time tracking via the CLI#44

Draft
dhth wants to merge 4 commits into
mainfrom
allow-time-tracking-via-the-cli
Draft

feat: allow time tracking via the CLI#44
dhth wants to merge 4 commits into
mainfrom
allow-time-tracking-via-the-cli

Conversation

@dhth

@dhth dhth commented Jan 19, 2025

Copy link
Copy Markdown
Owner

Adds the following interface via the CLI:

List tasks

hours tasks --limit 3
[
  {
    "id": 8,
    "summary": "sql",
    "created_at": "2025-01-18T15:22:41.178314+01:00",
    "updated_at": "2025-01-20T00:14:33.732783+01:00",
    "tracking_active": false,
    "seconds_spent": 77336
  },
  {
    "id": 1,
    "summary": "javascript",
    "created_at": "2025-01-18T15:22:41.093522+01:00",
    "updated_at": "2025-01-20T00:09:39.09208+01:00",
    "tracking_active": false,
    "seconds_spent": 86100
  },
  {
    "id": 2,
    "summary": "objective-c",
    "created_at": "2025-01-18T15:22:41.105774+01:00",
    "updated_at": "2025-01-19T23:38:34.912586+01:00",
    "tracking_active": false,
    "seconds_spent": 87978
  }
]

Start tracking

hours track start 8 -c "task comment goes here"
{
  "task_id": 8,
  "task_summary": "sql",
  "begin_ts": "2025-01-20T00:20:12.719771+01:00",
  "comment": "task comment goes here"
}

Update tracking

hours track update -b '2025/01/20 00:10' -c "task comment goes here, updated"
{
  "task_id": 8,
  "task_summary": "sql",
  "begin_ts": "2025-01-20T00:10:00+01:00",
  "comment": "task comment goes here, updated"
}

End tracking

hours track stop -b '2025/01/20 00:12' -e '2025/01/20 00:18' -c "task comment goes here, updated, again"
{
  "task_id": 8,
  "task_summary": "sql",
  "begin_ts": "2025-01-20T00:12:00+01:00",
  "end_ts": "2025-01-19T23:18:00+01:00",
  "seconds_spent": 360,
  "comment": "task comment goes here, updated, again"
}

Quick switch tracking

Given, a task being tracked:

hours track start 8 -c "task comment goes here"
# after a while
hours track start 2 -c "quick switched"
{
  "task_id": 2,
  "task_summary": "objective-c",
  "begin_ts": "2025-01-20T00:23:11.275523+01:00",
  "comment": "quick switched"
}

@dhth dhth linked an issue Jan 19, 2025 that may be closed by this pull request
@bjornasm

Copy link
Copy Markdown

Is there a hope that this will come into main? Being able to use the cli is really beneficial for quick start/stop of tasks especially.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add command to control tasks (start/stop)

2 participants