Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for "pausing" tracking? #5

Open
khughitt opened this issue Feb 5, 2021 · 9 comments
Open

Add support for "pausing" tracking? #5

khughitt opened this issue Feb 5, 2021 · 9 comments
Labels
enhancement New feature or request

Comments

@khughitt
Copy link
Contributor

khughitt commented Feb 5, 2021

If you can think of a simple way to support "pausing", that could be pretty useful.

Probably just a single command "zeit pause" to toggle it on/off.

On possible approach might be to create create a "pausedCounter", and then, after each pause/unpause, add - to the counter.

Then when zeit finish is called, you can simply check if the counter is non-zero, and if so, subtract that time from the full event duration.

@mrusme
Copy link
Owner

mrusme commented Feb 6, 2021

Hm, a paused entry would actually be two entries, one stopped at a certain time and a following one started at a later time. So basically you'd like to have a way to stop a running entry and then start a new tracker (on the same project/task) without having to manually specify all the details again, right?

What I could think of is an alias to finish that would be pause and a shortcut to track (including the last used options) that would be unpause.

@mrusme mrusme added the enhancement New feature or request label Feb 6, 2021
@khughitt
Copy link
Contributor Author

khughitt commented Feb 6, 2021

That's a good way to think about it.. Probably just need to be a little careful to capture/re-run the last track command, excluding things like "--begin" if they were specified.

@khughitt
Copy link
Contributor Author

nothing to do with this issue and perhaps not the best place for this, as a result, but, i just wanted to let you know that I've been using zeit steadily for the past couple months or so, and found it to be really helpful.. thanks for sharing this :)

@mrusme
Copy link
Owner

mrusme commented Mar 15, 2021

@khughitt thank you, appreciate it, glad you enjoy it! Haven't had much time lately to push zeit forward, mostly due to it working for me, heh. However, a few updates are in the making. :)

@khughitt
Copy link
Contributor Author

Heh. No worries! To be honest, it's been working great for me, so you aren't holding me up.

In case it helps, here are some aliases I defined to save a bit of time:

alias z='zeit'
alias zf='zeit finish'
alias zp='zeit track -p '
alias zl='zeit list'
alias zt='zeit tracking'
alias ze="zeit entry \`zeit --no-colors list | tail -1 | awk '{print \$1}'\`"
alias zrm="zeit erase \`zeit --no-colors list | tail -1 | awk '{print \$1}'\`"

I still need to get better about remembering to start/stop zeit sometimes (I tend to use --begin and --finish a bunch to make up for forgetting..), but even that is getting better with time.. I think it's just a matter of making it a habit.

@harnoorsaini
Copy link

harnoorsaini commented Jul 29, 2022

Hi @khughitt; I wrote the following alias that you may find handy:

function zbreak {
  date -v-$1M +%H:%M | xargs -I{} zeit finish -s {}
  zstart 
}

Example use case: you go for lunch/a walk/a nap for 28 minutes: Afterwards, you return to your Mac and type:

zbreak 28

This will pause the currently running task at the current time -28 minutes, and immediately restart it. This works for me as I only have one task. Not sure how it would work with multiple tasks.

@khughitt
Copy link
Contributor Author

Thanks, @harnoorsaini !

Great idea. Here is a version that works for me on linux:

function zbreak {
  # get current task
  tracking=`zeit tracking --no-colors`
  task_=`echo $tracking | grep --color='never' -o "on [a-z0-9\-]* for" | sed "s/on //" | sed "s/ for//"`

  # stop
  zeit finish -s "-0:$1"

  # resume
  zeit track -p $task_
}

It should at least work for times <= 59 mins.

@harnoorsaini
Copy link

@khughitt, oh sorry should have mentioned it's for macOS. And I have another of my aliases in there.

If you can pass "M" flag into date it should work for any number of minutes?

@khughitt
Copy link
Contributor Author

@harnoorsaini No worries! You did mention you are on a Mac :)

Thanks for the suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants