Skip to content

Commit

Permalink
chore(docs): auto generate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh authored and github-actions[bot] committed Nov 30, 2023
1 parent f67b59d commit 9bf7fa4
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions doc/pomo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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|


Expand All @@ -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.


==============================================================================
Expand All @@ -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",
Expand Down Expand Up @@ -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 }
},
}
<
Expand All @@ -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
Expand Down

0 comments on commit 9bf7fa4

Please sign in to comment.