Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/niuiic/task.nvim
Task manager for neovim.
https://github.com/niuiic/task.nvim
Last synced: 1 day ago
JSON representation
Task manager for neovim.
- Host: GitHub
- URL: https://github.com/niuiic/task.nvim
- Owner: niuiic
- License: mit
- Created: 2024-05-21T08:33:53.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-05-22T07:01:38.000Z (6 months ago)
- Last Synced: 2024-05-22T11:12:30.083Z (6 months ago)
- Language: Lua
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-neovim - niuiic/task.nvim - Another highly configurable task manager that enables seamless interaction with tasks. (Code Runner / Quickfix)
README
# task.nvim
Task manager for neovim.
[More neovim plugins](https://github.com/niuiic/awesome-neovim-plugins)
## Dependencies
- [niuiic/core.nvim](https://github.com/niuiic/core.nvim)
## Usage
1. Register tasks
```lua
local split_win = require("task.output").use_split_win()---@class task.Config
---@field cmd string
---@field args string[]
---@field options {env?: table, cwd?: string, uid?: number, gid?: number, verbatim?: boolean, detached?: boolean, hide?: boolean} | nil---@class task.Task
---@field name string
---@field is_enabled (fun(): boolean) | nil
---@field config fun(): task.Config
---@field on_err fun(output: string, write: fun(str), task_name: string) | fun(output: string, write: fun(str), task_name: string)[] | nil
---@field on_output fun(output: string, write: fun(str), task_name: string) | fun(output: string, write: fun(str), task_name: string)[] | nil
---@field on_exit fun(output: string, task_name: string) | fun(output: string, task_name: string)[] | nil---@param task task.Task
require("task").register({
name = "restart conatiner",
config = function()
return {
cmd = "sudo",
args = { "-S", "podman", "restart", "openresty" },
}
end,
on_err = function(output, write)
if string.match(output, "%[sudo%] password for.*") then
-- write to stdin
write("password\n")
end
end,
on_exit = {
require("task.output").notify_done,
split_win,
},
})
```2. Launch task
```lua
---@param task_name string | nil
require("task").launch()
```3. Preview output
```lua
---@param task_name string | nil
---@param output_method fun(output: string, task_name: string) | nil
require("task").preview()
```For builtin output methods, check `lua/task/output.lua`.