Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions lua/sf/org.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ function Org.fetch_org_list()
H.fetch_org_list()
end

function Org.get_current_target_org()
H.get_current_target_org()
end

function Org.set_target_org()
H.set_target_org()
end
Expand Down Expand Up @@ -124,6 +128,20 @@ H.clean_org_cache = function()
H.orgs = {}
end

H.get_current_target_org = function()
vim.system(
{"sf", "config", "get", "target-org", "--json"},
{ stdout = function(_, data)
if data ~= nil then
local org = vim.json.decode(data)
local target_org = org.result[1].value
U.target_org = target_org
end
end
}
)
end

H.set_target_org = function()
U.is_table_empty(H.orgs)
vim.ui.select(H.orgs, {
Expand Down
1 change: 1 addition & 0 deletions lua/sf/sub/config_auto_cmd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ M.set_auto_cmd_and_try_set_default_keys = function()
callback = function()
if vim.fn.executable("sf") == 1 then
require("sf").fetch_org_list()
require("sf.org").get_current_target_org()
end
end,
})
Expand Down
Loading