Discover, install, and configure shell plugins with Fig Plugin Store →
⌚️

Toggl Zsh Plugin

A oh-my-zsh plugin, printing the working hours of the current week tracked in toggl.com (for OSX).

natterstefan
|
5 stars
0 forks

Toggl Plugin for zsh

Features

:watch: get the total working hours of the current week with the toggl-week command:

$ toggl-week
$ You've worked 38 hours, 55 minutes and 46 seconds this week.

Installation

in your ~/.zshrc

git clone https://github.com/natterstefan/toggl-zsh-plugin.git
  • source the script at the end of ~/.zshrc:
source /path/to/toggl-zsh-plugin/toggl.plugin.zsh
  • source ~/.zshrc to take changes into account:
source ~/.zshrc

with oh-my-zsh

git clone https://github.com/natterstefan/toggl-zsh-plugin.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/toggl
  • Activate the plugin in ~/.zshrc by adding toggl to the plugins section:
plugins=( [plugins...] toggl)
  • source ~/.zshrc to take changes into account:
source ~/.zshrc

With antigen

Having antigen properly installed, just run:

antigen natterstefan/toggl-zsh-plugin

Setup

Add the following environment variables to your ~/.zshrc:

# open https://toggl.com/app/workspaces. Select the workspace you want to use,
# click on the three dots and open "Settings". Get the id from the URL in your
# browser. Eg. https://toggl.com/app/workspaces/12345678/settings?
export TOGGL_WORKSPACE_ID="12345678"

# open https://www.toggl.com/app/projects and select the project(s) you want to
# use in the report. Again copy the id from the url. In this case
# https://www.toggl.com/app/projects/12345678/edit/98765 the id would be 98765.
# This value can look like: "98765" or "98765,43210" for multiple project ids.
export TOGGL_PROJECT_IDS="98765"

# open https://toggl.com/app/profile and get the API token from the bottom of
# the page
export TOGGL_API_TOKEN="eNw1y5uVyYfW3aSVhHDZCcyAZGDfvezi1DmxjVXo"

Development

git clone https://github.com/natterstefan/toggl-zsh-plugin.git
mkdir ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/toggl
ls -s toggl.plugin.zsh ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/toggl/toggl.plugin.zsh

You are now ready to develop. After changing your code, you need to restart the terminal or source ~/.zshrc again. Don't forget to remove the symlink, in case you start from Installation again.

If this does not work, I recommend to create tmp/test.sh and make it executable. Then copy and paste the code from toggl.plugin.zsh into the file. Now, make changes and test it with ./tmp/test.sh. Once you are done, copy the code back into toggl.plugin.zsh.

Licence

Apache 2.0

This extension is not affiliated, associated, authorized, endorsed by or in any way officially connected to Toggl (toggl.com).

Maintainers


Stefan Natter