blob: 622eebd1c7063ce5dfaa0c6b3c90e78604b96f7f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
local config = require("cmake-explorer.config")
local runner = require("cmake-explorer.runner")
local Project = require("cmake-explorer.project")
local capabilities = require("cmake-explorer.capabilities")
local utils = require("cmake-explorer.utils")
local Path = require("plenary.path")
local pickers = require("cmake-explorer.telescope.pickers")
local notif = require("cmake-explorer.notification")
local M = {}
M.project = nil
local format_build_dir = function()
if Path:new(config.build_dir):is_absolute() then
return function(v)
return Path:new(v.path):make_relative(vim.env.HOME)
end
else
return function(v)
return Path:new(v.path):make_relative(M.project.path)
end
end
end
function M.configure(opts)
assert(M.project)
opts = opts or {}
pickers.configure(opts)
end
function M.configure_last(opts)
if not M.project.current_config then
notif.notify("No current configuration")
return
end
runner.start(M.project:configure_command())
end
function M.build(opts)
opts = opts or {}
pickers.build(opts)
end
function M.build_last(opts)
if not M.project.current_config then
notif.notify("No current configuration")
return
end
runner.start(M.project:build_command())
end
function M.setup(opts)
opts = opts or {}
config.setup(opts)
capabilities.setup()
M.project = Project:from_variants(config.default_variants)
if not M.project then
print("fuuuuuuuuuuuu")
return
end
end
return M
|