-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extract luarocks cli functions to luarocks module
- Loading branch information
Showing
4 changed files
with
57 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
---@mod rocks.luarocks | ||
-- | ||
-- Copyright (C) 2023 NTBBloodbath | ||
-- | ||
-- Version: 0.1.0 | ||
-- License: GPLv3 | ||
-- Created: 19 Jul 2023 | ||
-- Updated: 27 Aug 2023 | ||
-- Homepage: https://github.com/nvim-neorocks/rocks.nvim | ||
-- Maintainers: NTBBloodbath <bloodbathalchemist@protonmail.com>, Vhyrro <vhyrro@gmail.com> | ||
-- | ||
---@brief [[ | ||
-- | ||
-- Functions for interacting with the luarocks CLI | ||
-- | ||
---@brief ]] | ||
|
||
local luarocks = {} | ||
|
||
local constants = require("rocks.constants") | ||
local config = require("rocks.config") | ||
|
||
---@param args string[] luarocks CLI arguments | ||
---@param on_exit (function|nil) Called asynchronously when the luarocks command exits. | ||
--- asynchronously. Receives SystemCompleted object, see return of SystemObj:wait(). | ||
---@param opts? SystemOpts | ||
---@return vim.SystemObj | ||
---@see vim.system | ||
luarocks.cli = function(args, on_exit, opts) | ||
local luarocks_cmd = vim.list_extend({ | ||
"luarocks", | ||
"--lua-version=" .. constants.LUA_VERSION, | ||
"--tree=" .. config.rocks_path, | ||
}, args) | ||
return vim.system(luarocks_cmd, opts, on_exit) | ||
end | ||
|
||
return luarocks | ||
|
||
-- end of luarocks.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters