2018-02-19 22:07:04 +08:00
|
|
|
"=============================================================================
|
|
|
|
" health.vim --- SpaceVim health checker
|
2023-03-26 13:44:47 +08:00
|
|
|
" Copyright (c) 2016-2023 Wang Shidong & Contributors
|
2022-03-27 13:38:54 +08:00
|
|
|
" Author: Wang Shidong < wsdjeg@outlook.com >
|
2018-02-19 22:07:04 +08:00
|
|
|
" URL: https://spacevim.org
|
|
|
|
" License: GPLv3
|
|
|
|
"=============================================================================
|
|
|
|
|
2022-04-15 17:13:41 +08:00
|
|
|
let s:CMP = SpaceVim#api#import('vim#compatible')
|
|
|
|
|
|
|
|
|
2017-02-02 13:56:55 +08:00
|
|
|
function! SpaceVim#health#report() abort
|
2022-04-15 17:13:41 +08:00
|
|
|
let items = map(s:CMP.globpath(&rtp,'autoload/SpaceVim/health/*'), "fnamemodify(v:val,':t:r')")
|
2017-03-06 23:26:26 +08:00
|
|
|
let report = []
|
|
|
|
for item in items
|
|
|
|
try
|
|
|
|
let result = SpaceVim#health#{item}#check()
|
|
|
|
call extend(report,result)
|
|
|
|
catch /^Vim\%((\a\+)\)\=:E117/
|
|
|
|
call extend(report,[
|
|
|
|
\ '',
|
|
|
|
\ 'SpaceVim Health Error:',
|
|
|
|
\ ' There is no function: SpaceVim#health#' . item . '#check()',
|
|
|
|
\ '',
|
|
|
|
\ ])
|
|
|
|
endtry
|
|
|
|
endfor
|
2022-04-12 14:27:41 +08:00
|
|
|
return join(report + s:check_layers(), "\n")
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
function! s:check_layers() abort
|
2022-11-13 15:41:15 +08:00
|
|
|
let report = ['Checking SpaceVim layer health:']
|
2022-04-12 14:27:41 +08:00
|
|
|
for layer in SpaceVim#layers#get()
|
|
|
|
try
|
2022-11-13 15:41:15 +08:00
|
|
|
let result = SpaceVim#layers#{layer}#health() ? 'ok' : 'failed'
|
|
|
|
call extend(report, [' - `' . layer . '`:' . result])
|
2022-04-12 14:27:41 +08:00
|
|
|
catch /^Vim\%((\a\+)\)\=:E117/
|
2022-11-13 15:41:15 +08:00
|
|
|
call extend(report, [' - `' . layer . '`: can not find function: SpaceVim#layers#' . layer . '#health()'])
|
2022-04-12 14:27:41 +08:00
|
|
|
endtry
|
|
|
|
endfor
|
|
|
|
return report
|
2017-02-02 13:56:55 +08:00
|
|
|
endfunction
|
2017-03-06 23:26:26 +08:00
|
|
|
|
|
|
|
" vim:set et sw=2:
|