Skip to content

Commit 92eb9f4

Browse files
committed
feat: prep config, commands and search
1 parent ca2b5de commit 92eb9f4

3 files changed

Lines changed: 68 additions & 27 deletions

File tree

lua/lux-nvim/commands.lua

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---@mod rocks-commands rocks.nvim commands
1+
---@mod lux-commands lux.nvim commands
22
---
33
---@brief [[
44
---
@@ -7,32 +7,32 @@
77
--- command action
88
---------------------------------------------------------------------------------
99
---
10-
--- install {rock} {version?} {args[]?} Install {rock} with optional {version} and optional {args[]}.
11-
--- Example: ':Lux install neorg 8.0.0 opt=true'
12-
--- Will install or update to the latest version if called
13-
--- without {version}.
14-
--- args (optional):
15-
--- - opt={true|false}
16-
--- Rocks that have been installed with 'opt=true'
17-
--- can be sourced with |packadd|.
18-
--- - pin={true|false}
19-
--- Rocks that have been installed with 'pin=true'
20-
--- will be ignored by ':Lux update'.
21-
--- Use 'Rocks! install ...' to skip prompts.
22-
--- prune {rock} Uninstall {rock} and its stale dependencies,
23-
--- and remove it from rocks.toml.
24-
--- sync Synchronize installed rocks with rocks.toml.
25-
--- It may take more than one sync to prune all rocks that can be pruned.
26-
--- update {rock?} Search for updated rocks and install them.
27-
--- If called with the optional {rock} argument, only {rock}
28-
--- will be updated.
29-
--- Use 'Rocks! update` to skip prompts.
30-
--- with breaking changes.
31-
--- edit Edit the rocks.toml file.
32-
--- pin {rock} Pin {rock} to the installed version.
33-
--- Pinned rocks are ignored by ':Lux update'.
34-
--- unpin {rock} Unpin {rock}.
35-
--- log Open the log file.
10+
--- install {package} {version?} {args[]?} Install {package} with optional {version} and optional {args[]}.
11+
--- Example: ':Lux install neorg 8.0.0 opt=true'
12+
--- Will install or update to the latest version if called
13+
--- without {version}.
14+
--- args (optional):
15+
--- - opt={true|false}
16+
--- Packages that have been installed with 'opt=true'
17+
--- can be sourced with |packadd|.
18+
--- - pin={true|false}
19+
--- Packages that have been installed with 'pin=true'
20+
--- will be ignored by ':Lux update'.
21+
--- Use 'Lux! install ...' to skip prompts.
22+
--- prune {package} Uninstall {package} and its stale dependencies,
23+
--- and remove it from lux.toml.
24+
--- sync Synchronize installed packages with lux.toml.
25+
--- It may take more than one sync to prune all packages that can be pruned.
26+
--- update {package?} Search for updated packages and install them.
27+
--- If called with the optional {packages} argument, only {packages}
28+
--- will be updated.
29+
--- Use 'Lux! update` to skip prompts.
30+
--- with breaking changes.
31+
--- edit Edit the lux.toml file.
32+
--- pin {package} Pin {package} to the installed version.
33+
--- Pinned packages are ignored by ':Lux update'.
34+
--- unpin {package} Unpin {package}.
35+
--- log Open the log file.
3636
---
3737
---@brief ]]
3838
---

lua/lux-nvim/config/init.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@ local config = {}
1717
---@tag g:lux_nvim
1818
---@class LuxConfig
1919
---
20+
-- TODO(vhyrro): Generate these automatically from lux-lua
21+
---@field server string
22+
---@field extra_servers string[]
23+
---@field only_sources string
24+
---@field namespace string
25+
---@field lua_dir string
26+
---@field user_tree fun(lua_version: string)
27+
---@field no_force boolean
28+
---@field verbose boolean
29+
---@field timeout number
30+
---@field cache_dir string
31+
---@field data_dir string
32+
---@field entrypoint_layout table
33+
---@field variables table<string, string>
34+
---@field make_cmd string
35+
---@field cmake_cmd string
36+
---@field enabled_dev_servers string[]
37+
---
2038
--- Whether to query luarocks.org lazily (Default: `false`).
2139
--- Setting this to `true` may improve startup time,
2240
--- but features like auto-completion will lag initially.

lua/lux-nvim/operations/search.lua

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---@mod lux.operations.search lux.nvim package searching
2+
---
3+
---@brief [[
4+
---
5+
---Search for packages available on luarocks.org
6+
---
7+
---@brief ]]
8+
9+
local nio = require("nio")
10+
11+
local search = {}
12+
13+
---@class LuarocksSearchOpts
14+
---@field dev? boolean Include dev manifest? Default: false
15+
---@field servers? server_url[]|only_server_url Optional servers. Defaults to constants.ROCKS_SERVERS
16+
17+
---Search luarocks.org for all packages.
18+
---@type async fun(callback: fun(rocks_table: { [string]: Rock } ), opts?: LuarocksSearchOpts)
19+
search.search_all = nio.create(function(callback, opts)
20+
require("lux").operations.search()
21+
end)
22+
23+
return search

0 commit comments

Comments
 (0)