@@ -5,28 +5,32 @@ local util = require('guard.util')
55local events = require (' guard.events' )
66local M = {}
77
8+ local function check_cmd (conf , checked )
9+ if conf .cmd and not vim .tbl_contains (checked , conf .cmd ) then
10+ if fn .executable (conf .cmd ) == 1 then
11+ ok (conf .cmd .. ' found' )
12+ else
13+ error (conf .cmd .. ' not found' )
14+ end
15+ table.insert (checked , conf .cmd )
16+ end
17+ end
18+
819local function executable_check ()
920 local checked = {}
1021 for _ , item in pairs (filetype ) do
1122 for _ , conf in ipairs (item .formatter or {}) do
12- if conf .cmd and not vim .tbl_contains (checked , conf .cmd ) then
13- if fn .executable (conf .cmd ) == 1 then
14- ok (conf .cmd .. ' found' )
15- else
16- error (conf .cmd .. ' not found' )
17- end
18- table.insert (checked , conf .cmd )
23+ if conf .health then
24+ conf .health ()
25+ else
26+ check_cmd (conf , checked )
1927 end
2028 end
21-
2229 for _ , conf in ipairs (item .linter or {}) do
23- if conf .cmd and not vim .tbl_contains (checked , conf .cmd ) then
24- if fn .executable (conf .cmd ) == 1 then
25- ok (conf .cmd .. ' found' )
26- else
27- error (conf .cmd .. ' not found' )
28- end
29- table.insert (checked , conf .cmd )
30+ if conf .health then
31+ conf .health ()
32+ else
33+ check_cmd (conf , checked )
3034 end
3135 end
3236 end
0 commit comments