项目作者: kevinschoon

项目描述 :
Pomodoro CLI
高级语言: Go
项目地址: git://github.com/kevinschoon/pomo.git
创建时间: 2018-01-16T09:48:06Z
项目社区:https://github.com/kevinschoon/pomo

开源协议:MIT License

下载


demo

Migration Notice

This project has been migrated to codeberg, new contributions will only be accepted on that platform.

🍅 pomo

pomo

pomo is a simple CLI for using the Pomodoro Technique. There are some amazing task management systems but pomo is more of a task execution or timeboxing system. pomo helps you track what you did, how long it took you to do it, and how much effort you expect it to take.

Background

The Pomodoro Technique is simple and effective:

  • Decide on a task you want to accomplish
  • Break the task into timed intervals (pomodoros), [approx. 25 min]
  • After each pomodoro take a short break [approx. 3 - 5 min]
  • Once all pomodoros are completed take a longer break [approx 15 - 20 min]
  • Repeat

Installation

Source

  1. git clone git@github.com:kevinschoon/pomo.git
  2. cd pomo
  3. make
  4. # copy pomo somewhere on your $PATH
  5. cp bin/pomo ~/bin/

Package Managers

On Arch Pomo is available on the aur.

On macOS, pomo can be installed via MacPorts.

Usage

Once pomo is installed you need to initialize it’s database.

  1. pomo init

Start a 4 pomodoro session at 25 minute intervals:

  1. pomo start -t my-project "write some codes"

Configuration

Pomo has a few configuration options which can be read from a JSON file in Pomo’s config directory ~/.config/pomo/config.json.

colors

You can map colors to specific tags in the colors field.

Example:

  1. {
  2. "colors": {
  3. "my-project": "hiyellow",
  4. "another-project": "green"
  5. }
  6. }

Execute command on state change

Pomo will execute an arbitrary command specified in the array argument onEvent
when the state changes. The first element of this array should be the
executable to run while the remaining elements are space delimited arguments.
The new state will be exported as an environment variable POMO_STATE for this
command. Possible state values are RUNNING, PAUSED, BREAKING, or
COMPLETE.

For example, to trigger a terminal bell when a session completes, add the
following to config.json:

  1. ...
  2. "onEvent": ["/bin/sh", "/path/to/script/my_script.sh"],
  3. ...

where the contents of my_script.sh are

  1. #!/bin/sh
  2. if [ "$POMO_STATE" == "COMPLETE" ] ; then
  3. echo -e '\a'
  4. fi

See the contrib directory for user contributed scripts for use with onEvent.

Integrations

By default pomo will setup a Unix socket and serve it’s status there.

  1. echo | socat stdio UNIX-CONNECT:$HOME/.pomo/pomo.sock | jq .
  2. {
  3. "state": 1,
  4. "remaining": 1492000000000,
  5. "count": 0,
  6. "n_pomodoros": 4
  7. }

Alternately by setting the publish flag to true it will publish it’s status
to an existing socket.

Status Bars

The Pomo CLI can output the current state of a running task session via the pomo status
making it easy to script and embed it’s output in various Linux status bars.

Polybar

You can create a module with the custom/script type and
embed Pomo’s status output in your Polybar:

  1. [module/pomo]
  2. type = custom/script
  3. interval = 1
  4. exec = pomo status

luastatus

Configured this bar by setting publish to true.

  1. widget = {
  2. plugin = "unixsock",
  3. opts = {
  4. path = "pomo.sock",
  5. timeout = 2,
  6. },
  7. cb = function(t)
  8. local full_text
  9. local foreground = ""
  10. local background = ""
  11. if t.what == "line" then
  12. if string.match(t.line, "R") then
  13. -- green
  14. foreground = "#ffffff"
  15. background = "#307335"
  16. end
  17. if string.match(t.line, "B") or string.match(t.line, "P") or string.match(t.line, "C") then
  18. -- red
  19. foreground = "#ffffff"
  20. background = "ff8080"
  21. end
  22. return { full_text = t.line, background = background, foreground = foreground }
  23. elseif t.what == "timeout" then
  24. return { full_text = "-" }
  25. elseif t.what == "hello" then
  26. return { full_text = "-" }
  27. end
  28. end,
  29. }

Roadmap

  • Generate charts/burn down
  • ??

Credits