# rust-cli-pomodoro A terminal Pomodoro timer that manages your time with customizable work and break periods, desktop/Slack/Discord notifications, and interactive or IPC-based control. ## Demo ![Demo](assets/pomodoro_demo.gif) ## Features - Create notifications with customized work and break time. - When a configuration file is given, notifications use default values from it. - Queue notifications; a queued notification starts after previously registered ones finish. - Customize notification delivery channels (see "Using configuration.json" below). - Pretty-print created notifications with the `list` command. - Delete registered notification(s). - Track archived notification(s) with the `history` command. - Delete archived notifications with `history --clear`. - Clear the terminal. - Command history look-up with arrow keys in interaction mode. - Generate auto-completion scripts for several shells (fish, zsh, bash, elvish, powershell). > A "notification" consists of a work time and a break time. Pomodoro manages timers > using "notifications". ## Command-line usage Pomodoro supports two input types: standard input (interactive) and IPC (via a unix domain socket). Commands differ slightly depending on the input type. ### Start up & IPC command Start up by running `pomodoro` with the appropriate `OPTIONS`, or send a command to an already-running instance via IPC using a `SUBCOMMAND`. ``` pomodoro 1.4.0 start up application with config or run command using uds client Usage: pomodoro [OPTIONS] pomodoro Commands: create create the notification queue create the notification delete delete a notification list list notifications history show archived notifications test test notification completion generate completions for shells help Print this message or the help of the given subcommand(s) Options: -c, --config Read configuration json file from this path -h, --help Print help -V, --version Print version ``` ### Standard input (interactive) command While pomodoro is running, you can interactively issue commands. ``` pomodoro 1.4.0 manage your time! Usage: pomodoro [COMMAND] Commands: create create the notification queue create the notification delete delete a notification list list notifications history show archived notifications test test notification clear clear terminal exit exit pomodoro app help Print this message or the help of the given subcommand(s) Options: -h, --help Print help -V, --version Print version ``` ## Subcommand reference ### create / queue Create (or queue) a notification. - `-w, --work ` — focus time in minutes. If omitted, the value is taken from `work_time_default_value` in the configuration file; if unavailable, 25 is used. - `-b, --break ` — break time in minutes. If omitted, the value is taken from `break_time_default_value` in the configuration file; if unavailable, 5 is used. - `-d, --default` — create a notification using the default work/break values from the configuration file (or 25/5 if absent). Conflicts with `--work` and `--break`. ### delete Delete a notification. - `-i, --id ` — the ID of the notification to delete. - `-a, --all` — delete all notifications. ### list List notifications. - `-p` — show work-time completion percentage. ### history Show archived notifications. - `-c, --clear` — delete all notifications from history. ### test Send a test notification. ### completion Generate completion scripts for shells. ``` Usage: pomodoro completion [shell] Arguments: [shell] [possible values: fish, zsh, bash, elvish, powershell] ``` ## Installation Clone the repository and run: ```sh git clone git@github.com:24seconds/rust-cli-pomodoro.git cd rust-cli-pomodoro cargo run --release ``` Or install with cargo: ```sh cargo install rust-cli-pomodoro ``` ## Using configuration.json Pomodoro supports several configuration options: - Slack notification - Discord notification - Default work time value - Default break time value Create a JSON file (for example `configuration.json`) with the following shape: ```json { "slack": { "token": "your-bot-token-string", "channel": "your-slack-channel-id" }, "discord": { "webhook_url": "your-webhook-url" }, "work_time_default_value": 30, "break_time_default_value": 10 } ``` - Slack notifications use the [chat.PostMessage API](https://api.slack.com/methods/chat.postMessage). - Discord notifications use a [webhook URL](https://discord.com/developers/docs/resources/webhook). Run pomodoro with the configuration file: ```sh # If the configuration.json file exists in the current path pomodoro --config ./configuration.json ``` ## Auto completion `rust-cli-pomodoro` supports tab completion. Generate the completion script manually and place it in the appropriate shell path. ![Auto completion example](assets/auto_completion_example.png) ### Step 1. Generate the completion script file ```sh Usage: pomodoro completion [shell] Arguments: [shell] [possible values: fish, zsh, bash, elvish, powershell] ``` For example, for zsh: ```sh $ pomodoro completion zsh > _pomodoro ``` The file name should be underscore + binary name, i.e. `_pomodoro`. ### Step 2. Put the completion script file in the proper path For zsh, the proper path is one of the directories in `$fpath`: ```sh > echo $fpath ``` For example, `/Users/young/.oh-my-zsh/completions`. ### Step 3. Reload the shell ```sh $ exec zsh # or $ source ~/.zshrc ``` Newly opened terminals will work without this step. ## Compatibility - Start up & standard input: depends on [notify-rust](https://github.com/hoodie/notify-rust); supports Linux, macOS (<= 11.0.0), and Windows (10, 8.1). - IPC: Linux and macOS (pomodoro uses a unix domain socket).