Merge pull request #1550 from deivid-rodriguez/bundle_option_for_mdl

Add bundle option to mdl
This commit is contained in:
w0rp 2018-05-03 22:20:39 +01:00 committed by GitHub
commit 726a768464
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View file

@ -10,9 +10,13 @@ endfunction
function! ale_linters#markdown#mdl#GetCommand(buffer) abort function! ale_linters#markdown#mdl#GetCommand(buffer) abort
let l:executable = ale_linters#markdown#mdl#GetExecutable(a:buffer) let l:executable = ale_linters#markdown#mdl#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'bundle$'
\ ? ' exec mdl'
\ : ''
let l:options = ale#Var(a:buffer, 'markdown_mdl_options') let l:options = ale#Var(a:buffer, 'markdown_mdl_options')
return ale#Escape(l:executable) return ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:options) ? ' ' . l:options : '')
endfunction endfunction

View file

@ -10,7 +10,8 @@ g:ale_markdown_mdl_executable *g:ale_markdown_mdl_executable*
Type: |String| Type: |String|
Default: `'mdl'` Default: `'mdl'`
See |ale-integrations-local-executables| Override the invoked mdl binary. This is useful for running mdl from
binstubs or a bundle.
g:ale_markdown_mdl_options *g:ale_markdown_mdl_options* g:ale_markdown_mdl_options *g:ale_markdown_mdl_options*

View file

@ -26,3 +26,10 @@ Execute(The executable and options should be configurable):
AssertEqual AssertEqual
\ ale_linters#markdown#mdl#GetCommand(bufnr('')), \ ale_linters#markdown#mdl#GetCommand(bufnr('')),
\ ale#Escape('foo bar') . ' --wat' \ ale#Escape('foo bar') . ' --wat'
Execute(Setting bundle appends 'exec mdl'):
let g:ale_markdown_mdl_executable = 'path to/bundle'
AssertEqual
\ ale#Escape('path to/bundle') . ' exec mdl',
\ ale_linters#markdown#mdl#GetCommand(bufnr(''))