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

Update readme with QoL aliases #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,40 @@ Export a Tyme 3 JSON:
zeit export --format tyme --project "my project" --since "2020-04-01T15:04:05+07:00" --until "2020-04-04T15:04:05+07:00"
```

### Quality of life aliases
All tested in `zsh` under `macOS Monterey Version 12.4` for a single task. An example of the time formats is as follows: `1994-11-05T08:15:30-05:00 corresponds to November 5, 1994, 8:15:30 am, US Eastern Standard Time.`

#### Examples:

Getting running totals (includes the currently running task time):

```
alias zlist-all="zeit list"
```

Today:
```
alias zlist-tday="zlist-all --since "$(date +%F)T00:00:00+12:00" --total"
```

Current week:
```
alias zlist-cweek="zlist-all --since "$(date -v -Mon +%F)T00:00:00+12:00" --total | grep TOTAL:"
```

Current month (coincides with total under `zeit stats`):
```
alias zlist-cmonth="zlist-all --since "$(date +%Y-%m-01)T00:00:00+12:00" --total | grep TOTAL:"
```

Pausing the current task retroactively, e.g., after getting back from lunch. Replace `YOUR_PROJECT` and `YOUR_TASK` appropriately.
```
function zbreak {
date -v-$1M +%H:%M | xargs -I{} zeit finish -s {}
zeit track --project YOUR_PROJECT --task YOUR_TASK
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this?

function zbreak {
  project=$(zeit tracking --no-colors | sed 's/.* on \(.*\) for .*/\1/gI')
  task=$(zeit tracking --no-colors | sed 's/. tracking \(.*\) on .*/\1/gI')
  date -v-$1M +%H:%M | xargs -I{} zeit finish -s {}
  zeit track --project "$project" --task "$task"
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

BTW, I tried some aliases for "yesterday" and "last week" using --since and --until. The problem is that the currently running task is also summed to the total.

For example, last week total:

zeit list --since "$(date -v-sunday -v-7d +%F)T00:00:00+12:00" --until "$(date -v-sunday +%F)T00:00:00+12:00" --total

I tried using grep/awk/sed but that's beyond my skill/need :)

}
```

## Integrations

Here are a few integrations and extensions built by myself as well as other
Expand Down