jazzband / Watson

:watch: A wonderful CLI to track your time!
http://tailordev.github.io/Watson/
MIT License
2.46k stars 240 forks source link

Command to transition between projects and/or tags #461

Closed addisonklinke closed 2 years ago

addisonklinke commented 2 years ago

Often I find myself in the following pattern

watson start work +project

... some time later

watson stop
watson start personal +lunch

This immediate transition of one project (or set of tags) into another seems like it could be easily combined into a single command. This way the above would get replaced with

watson start work +project
watson transition personal +lunch

The transition command should support the same flags such as --at (i.e. if you forgot to stop your work project before heading to lunch, you could mark the transition at some point in the past once you return)

jmaupetit commented 2 years ago

Hi @addisonklinke :wave:

By setting the stop_on_start option to true in your configuration file, you can use the following:

watson start work +project
watson start personal +lunch

And the second start command will stop the previous task. Pretty neat, huh?

You will find more information in the settings documentation: https://tailordev.github.io/Watson/user-guide/configuration/#available-settings

HTH.

addisonklinke commented 2 years ago

@jmaupetit Thanks for the pointer, that is a nice config option! Unfortunately it doesn't support the --at flag for marking the transition at some point in the past. If you attempt this, you'll get

Error: Task cannot start before the previous task ends

This also brings the tracker into an inconsistent state because the previous task gets stopped without notifying the user (even though the new task failed to start). Could we modify start to handle this appropriately?

jmaupetit commented 2 years ago

It should be feasible to add such support. Can you declare a new issue for this specific feature request or better: propose a PR? :pray: :muscle: :heart:

addisonklinke commented 2 years ago

It looks like the backend is written in Python. Could you provide some guidance on the general structure/framework and where to start?