From 9bf7fa4d2d81162673a1c736e22bac9977ce023b Mon Sep 17 00:00:00 2001 From: epwalsh Date: Thu, 30 Nov 2023 20:19:22 +0000 Subject: [PATCH] chore(docs): auto generate docs --- doc/pomo.txt | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/doc/pomo.txt b/doc/pomo.txt index eb8b364..79a5e51 100644 --- a/doc/pomo.txt +++ b/doc/pomo.txt @@ -16,7 +16,7 @@ Lua. - 🪶 Lightweight and asynchronous - 💻 Written in Lua - ⚙️ Easily customizable and extendable -- ⏱️ Run multiple concurrent timers +- ⏱️ Run multiple concurrent timers and repeat timers - ➕ Integrate with |pomo-lualine| @@ -32,6 +32,8 @@ COMMANDS *pomo-commands* "minute", or "minutes" for minutes. - `:TimerStop [TIMERID]` to stop a running timer, e.g. `:TimerStop 1`. If no ID is given, the latest timer is stopped. +- `:TimerRepeat TIMELIMIT REPETITIONS [NAME]` to start a repeat timer, + e.g. `:TimerRepeat 10s 2` to repeat a 10 second timer twice. ============================================================================== @@ -49,7 +51,7 @@ USING LAZY.NVIM *pomo-using-lazy.nvim* "epwalsh/pomo.nvim", version = "*", -- Recommended, use latest release instead of latest commit lazy = true, - cmd = { "TimerStart", "TimerStop" }, + cmd = { "TimerStart", "TimerStop", "TimerRepeat" }, dependencies = { -- Optional, but highly recommended if you want to use the "Default" timer "rcarriga/nvim-notify", @@ -110,7 +112,7 @@ read each option carefully and customize it to your needs: -- You can also define custom notifiers by providing an "init" function instead of a name. -- See "Defining custom notifiers" below for an example 👇 - -- { init = function(timer_id, time_limit, name) ... end } + -- { init = function(timer) ... end } }, } < @@ -128,35 +130,32 @@ class needs to have the following methods - `Notifier.done(self)` - Called when the timer finishes. - `Notifier.stop(self)` - Called when the timer is stopped before finishing. -The factory `init` function takes 3 or 4 arguments, the `timer_id` (an -integer), the `time_limit` seconds (an integer), the `name` assigned to the -timer (a string or `nil`), and optionally a table of options from the `opts` -field in the notifier’s config. +The factory `init` function takes 1 or 2 arguments, the `timer` (a +`pomo.Timer`) and optionally a table of options from the `opts` field in the +notifier’s config. For example, here’s a simple notifier that just uses `print`: >lua local PrintNotifier = {} - PrintNotifier.new = function(timer_id, time_limit, name, opts) + PrintNotifier.new = function(timer, opts) local self = setmetatable({}, { __index = PrintNotifier }) - self.timer_id = timer_id - self.time_limit = time_limit - self.name = name and name or "Countdown" + self.timer = timer self.opts = opts -- not used return self end PrintNotifier.start = function(self) - print(string.format("Starting timer #%d, %s, for %ds", self.timer_id, self.name, self.time_limit)) + print(string.format("Starting timer #%d, %s, for %ds", self.timer.id, self.timer.name, self.timer.time_limit)) end PrintNotifier.tick = function(self, time_left) - print(string.format("Timer #%d, %s, %ds remaining...", self.timer_id, self.name, time_left)) + print(string.format("Timer #%d, %s, %ds remaining...", self.timer.id, self.timer.name, time_left)) end PrintNotifier.done = function(self) - print(string.format("Timer #%d, %s, complete", self.timer_id, self.name)) + print(string.format("Timer #%d, %s, complete", self.timer.id, self.timer.name)) end PrintNotifier.stop = function(self) end