Skip to content

Commit bc003db

Browse files
Merge pull request #41 from jonathanmorris180/fix/issue-40
Pull executable from $PATH
2 parents 1dce2fd + 5004334 commit bc003db

File tree

10 files changed

+9
-20
lines changed

10 files changed

+9
-20
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ require("salesforce").setup({
131131
org_manager = {
132132
default_org_indicator = "󰄬",
133133
},
134-
-- Default SF CLI executable (should not need to be changed)
135-
sf_executable = "sf",
136134
})
137135
```
138136

doc/salesforce.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ You can pass in a lua table of options to customize the plugin. The default opti
4747
org_manager = {
4848
default_org_indicator = "󰄬",
4949
},
50-
-- Default SF CLI executable (should not need to be changed)
51-
sf_executable = "sf",
5250
}
5351
<
5452

lua/salesforce/config.lua

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,8 @@ function Config:new()
2424
org_manager = {
2525
default_org_indicator = "󰄬",
2626
},
27-
-- Default SF CLI executable (should not need to be changed)
28-
sf_executable = "sf",
2927
}
3028

31-
if jit.os == "Windows" then
32-
o.options.sf_executable = "sf.cmd"
33-
end
34-
3529
return o
3630
end
3731

lua/salesforce/diff.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ local Util = require("salesforce.util")
22
local Job = require("plenary.job")
33
local Debug = require("salesforce.debug")
44
local OrgManager = require("salesforce.org_manager")
5-
local Config = require("salesforce.config")
65

76
function Job:is_running()
87
if self.handle and not vim.loop.is_closing(self.handle) and vim.loop.is_active(self.handle) then
@@ -15,7 +14,7 @@ end
1514
local M = {}
1615

1716
local temp_dir
18-
local executable = Config:get_options().sf_executable
17+
local executable = Util.get_sf_executable()
1918

2019
local function diff_callback(j)
2120
vim.schedule(function()

lua/salesforce/execute_anon.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ local Debug = require("salesforce.debug")
33
local OrgManager = require("salesforce.org_manager")
44
local Job = require("plenary.job")
55
local Util = require("salesforce.util")
6-
local Config = require("salesforce.config")
76

87
function Job:is_running()
98
if self.handle and not vim.loop.is_closing(self.handle) and vim.loop.is_active(self.handle) then
@@ -47,7 +46,7 @@ M.execute_anon = function()
4746

4847
Popup:create_popup({})
4948
Popup:write_to_popup("Executing anonymous Apex script...")
50-
local executable = Config:get_options().sf_executable
49+
local executable = Util.get_sf_executable()
5150
local args = {}
5251
local writer = nil
5352
if not is_unsaved_buffer then

lua/salesforce/file_manager.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ end
1414

1515
local M = {}
1616

17-
local executable = Config:get_options().sf_executable
17+
local executable = Util.get_sf_executable()
1818
local active_file_path = nil
1919

2020
local function push_to_org_callback(j)

lua/salesforce/init.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343
--- org_manager = {
4444
--- default_org_indicator = "󰄬",
4545
--- },
46-
--- -- Default SF CLI executable (should not need to be changed)
47-
--- sf_executable = "sf",
4846
--- }
4947
--- <
5048
local Config = require("salesforce.config")

lua/salesforce/org_manager.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function Job:is_running()
1414
end
1515

1616
local OrgManager = {}
17-
local executable = Config:get_options().sf_executable
17+
local executable = Util.get_sf_executable()
1818

1919
function OrgManager:new()
2020
local o = {}

lua/salesforce/test_runner.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ local OrgManager = require("salesforce.org_manager")
44
local Debug = require("salesforce.debug")
55
local Treesitter = require("salesforce.treesitter")
66
local Util = require("salesforce.util")
7-
local Config = require("salesforce.config")
87

9-
local executable = Config:get_options().sf_executable
8+
local executable = Util.get_sf_executable()
109
local run_class_command = executable .. ' apex run test -n "%s" --synchronous -r human -o %s'
1110
local run_method_command = executable .. ' apex run test -t "%s.%s" --synchronous -r human -o %s'
1211

lua/salesforce/util.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,8 @@ function M.clear_error_diagnostics()
158158
vim.diagnostic.reset(namespace, bufnr)
159159
end
160160

161+
function M.get_sf_executable()
162+
return vim.fn.fnamemodify(vim.fn.exepath("sf"), ":t")
163+
end
164+
161165
return M

0 commit comments

Comments
 (0)