@@ -34,6 +34,21 @@ local function remove_newlines(cmd)
34
34
return cmd
35
35
end
36
36
37
+ --- Finds a "x.y.z" version string from the output of `cmd`, and returns the whole line.
38
+ ---
39
+ --- If a version string is not found, returns the concatenated output.
40
+ ---
41
+ --- @param cmd string[]
42
+ local function try_get_version (cmd )
43
+ local out = vim .fn .system (cmd )
44
+ if not out then
45
+ return nil
46
+ end
47
+ local version_line = out :match (' [^\r\n ]+%d+%.[0-9.]+[^\r\n ]+' )
48
+ local s = vim .trim (version_line and version_line or out :gsub (' [\r\n ]' , ' ' ))
49
+ return s
50
+ end
51
+
37
52
--- Prettify a path for presentation.
38
53
local function fmtpath (p )
39
54
if vim .startswith (p , ' Running' ) then
@@ -104,10 +119,13 @@ local function make_config_info(config, bufnr)
104
119
' Config: ' .. config_info .name ,
105
120
}
106
121
122
+ local cmd_version = { config_info .cmd , ' --version' }
123
+
107
124
local info_lines = {
108
125
' filetypes: ' .. config_info .filetypes ,
109
126
' root directory: ' .. fmtpath (config_info .root_dir ),
110
127
' cmd: ' .. fmtpath (config_info .cmd ),
128
+ (' %-18s `%s`' ):format (' version:' , try_get_version (cmd_version )),
111
129
' cmd is executable: ' .. config_info .cmd_is_executable ,
112
130
' autostart: ' .. config_info .autostart ,
113
131
' custom handlers: ' .. config_info .handlers ,
0 commit comments