Skip to content

Commit bdbe113

Browse files
committed
Check GTM exe version
1 parent ba65c61 commit bdbe113

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

plugin/gtm.vim

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,38 @@
55
if exists('g:gtm_plugin_loaded') || &cp
66
finish
77
endif
8+
let g:gtm_plugin_loaded = 0
9+
10+
let s:gtm_ver_req = '>= 1.0-beta.6'
811

912
let s:no_gtm_err = 'GTM exe not found, install GTM or update path, see https://www.github.com/git-time-metric/gtm'
13+
let s:gtm_ver_err = 'GTM exe is out of date, please install the latest GTM, see https://www.github.com/git-time-metric/gtm'
1014

1115
if executable('gtm') == 0
1216
echomsg s:no_gtm_err
17+
echomsg "GTM plug-in NOT LOADED"
18+
finish
19+
endif
20+
21+
function! s:verify(ver)
22+
let output=system('gtm verify ' . shellescape(a:ver))
23+
if v:shell_error
24+
return 0
25+
else
26+
if output != 'true'
27+
return 0
28+
endif
29+
endif
30+
return 1
31+
endfunction
32+
33+
if s:verify(s:gtm_ver_req) == 0
34+
echomsg s:gtm_ver_err
35+
echomsg "GTM plug-in NOT LOADED"
1336
finish
1437
endif
1538

39+
" plug-in is loading successfully
1640
let g:gtm_plugin_loaded = 1
1741

1842
let g:gtm_plugin_status_enabled = get(g:, 'gtm_plugin_status_enabled', 0)

0 commit comments

Comments
 (0)