mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 23:50:04 +08:00
Fix mkdir plugin, ignore error message (#2392)
This commit is contained in:
parent
e43000775c
commit
44a8acad93
@ -64,12 +64,12 @@ function! s:write_to_config(config) abort
|
|||||||
let g:_spacevim_global_config_path = global_dir . 'init.toml'
|
let g:_spacevim_global_config_path = global_dir . 'init.toml'
|
||||||
let cf = global_dir . 'init.toml'
|
let cf = global_dir . 'init.toml'
|
||||||
if filereadable(cf)
|
if filereadable(cf)
|
||||||
call SpaceVim#logger#warn("Failed to generate config file, It is not readable: " . cf)
|
call SpaceVim#logger#warn('Failed to generate config file, It is not readable: ' . cf)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let dir = expand(fnamemodify(cf, ':p:h'))
|
let dir = expand(fnamemodify(cf, ':p:h'))
|
||||||
if !isdirectory(dir)
|
if !isdirectory(dir)
|
||||||
call mkdir(dir), 'p')
|
call mkdir(dir, 'p')
|
||||||
endif
|
endif
|
||||||
call writefile(a:config, cf, '')
|
call writefile(a:config, cf, '')
|
||||||
endfunction
|
endfunction
|
||||||
@ -84,9 +84,12 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! SpaceVim#custom#apply(config, type) abort
|
function! SpaceVim#custom#apply(config, type) abort
|
||||||
|
" the type can be local or global
|
||||||
|
" local config can override global config
|
||||||
if type(a:config) != type({})
|
if type(a:config) != type({})
|
||||||
call SpaceVim#logger#info('config type is wrong!')
|
call SpaceVim#logger#info('config type is wrong!')
|
||||||
else
|
else
|
||||||
|
call SpaceVim#logger#info('start to apply config [' . a:type . ']')
|
||||||
let options = get(a:config, 'options', {})
|
let options = get(a:config, 'options', {})
|
||||||
for [name, value] in items(options)
|
for [name, value] in items(options)
|
||||||
exe 'let g:spacevim_' . name . ' = value'
|
exe 'let g:spacevim_' . name . ' = value'
|
||||||
@ -119,7 +122,8 @@ function! SpaceVim#custom#apply(config, type) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#custom#write(force) abort
|
function! SpaceVim#custom#write(force) abort
|
||||||
|
if a:force
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:path_to_fname(path) abort
|
function! s:path_to_fname(path) abort
|
||||||
@ -127,7 +131,7 @@ function! s:path_to_fname(path) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#custom#load() abort
|
function! SpaceVim#custom#load() abort
|
||||||
" if file .SpaceVim.d/init.toml exist
|
" if file .SpaceVim.d/init.toml exist
|
||||||
if filereadable('.SpaceVim.d/init.toml')
|
if filereadable('.SpaceVim.d/init.toml')
|
||||||
let g:_spacevim_config_path = fnamemodify('.SpaceVim.d/init.toml', ':p')
|
let g:_spacevim_config_path = fnamemodify('.SpaceVim.d/init.toml', ':p')
|
||||||
let &rtp = fnamemodify('.SpaceVim.d', ':p:h') . ',' . &rtp
|
let &rtp = fnamemodify('.SpaceVim.d', ':p:h') . ',' . &rtp
|
||||||
@ -206,7 +210,10 @@ endfunction
|
|||||||
|
|
||||||
" FIXME: the type should match the toml's type
|
" FIXME: the type should match the toml's type
|
||||||
function! s:opt_type(opt) abort
|
function! s:opt_type(opt) abort
|
||||||
let var = get(g:, 'spacevim_' . a:opt, '')
|
" autoload/SpaceVim/custom.vim:221:31:Error: EVL103: unused argument `a:opt`
|
||||||
|
" @bugupstream viml-parser seem do not think this is used argument
|
||||||
|
let opt = a:opt
|
||||||
|
let var = get(g:, 'spacevim_' . opt, '')
|
||||||
if type(var) == type('')
|
if type(var) == type('')
|
||||||
return '[string]'
|
return '[string]'
|
||||||
elseif type(var) == 5
|
elseif type(var) == 5
|
||||||
@ -219,7 +226,9 @@ function! s:opt_type(opt) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:short_desc_of_opt(opt) abort
|
function! s:short_desc_of_opt(opt) abort
|
||||||
" TODO: add short desc for each options
|
if a:opt =~# '^enable_'
|
||||||
|
else
|
||||||
|
endif
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -17,7 +17,11 @@ endfunction
|
|||||||
|
|
||||||
fun! s:Mkdirp(dir) abort
|
fun! s:Mkdirp(dir) abort
|
||||||
if exists('*mkdir')
|
if exists('*mkdir')
|
||||||
call mkdir(a:dir, 'p')
|
try
|
||||||
|
call mkdir(a:dir, 'p')
|
||||||
|
catch
|
||||||
|
call SpaceVim#logger#error('failed to create dir:' . a:dir)
|
||||||
|
endtry
|
||||||
else
|
else
|
||||||
" @todo mkdir only exist in *nix os
|
" @todo mkdir only exist in *nix os
|
||||||
call system('mkdir -p '.shellescape(a:dir))
|
call system('mkdir -p '.shellescape(a:dir))
|
||||||
|
15
codecov.yml
15
codecov.yml
@ -1,9 +1,14 @@
|
|||||||
coverage:
|
|
||||||
range: 30..60
|
|
||||||
round: down
|
|
||||||
precision: 2
|
|
||||||
comment:
|
comment:
|
||||||
layout: "header, diff, changes, uncovered"
|
layout: "header, diff, changes, uncovered"
|
||||||
behavior: default # update if exists else create new
|
behavior: default # update if exists else create new
|
||||||
codecov:
|
codecov:
|
||||||
branch: dev
|
branch: master
|
||||||
|
coverage:
|
||||||
|
status:
|
||||||
|
project:
|
||||||
|
default: false # disable the default status that measures entire project
|
||||||
|
tests: # declare a new status context "tests"
|
||||||
|
target: 100% # we always want 100% coverage here
|
||||||
|
paths: "tests/" # only include coverage in "tests/" folder
|
||||||
|
app: # declare a new status context "app"
|
||||||
|
paths: "!tests/" # remove all files in "tests/"
|
||||||
|
Loading…
Reference in New Issue
Block a user