Allow custom filters for the jq fixer (#1980)

* Allow the jq filters to receive custom filters.
* Update documentation.
This commit is contained in:
Aliou Diallo
2018-10-12 10:15:32 +02:00
committed by w0rp
parent e5b5ce9f51
commit b7ec11c93d
3 changed files with 28 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
call ale#Set('json_jq_executable', 'jq')
call ale#Set('json_jq_options', '')
call ale#Set('json_jq_filters', '.')
function! ale#fixers#jq#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'json_jq_executable')
@@ -7,9 +8,15 @@ endfunction
function! ale#fixers#jq#Fix(buffer) abort
let l:options = ale#Var(a:buffer, 'json_jq_options')
let l:filters = ale#Var(a:buffer, 'json_jq_filters')
if empty(l:filters)
return 0
endif
return {
\ 'command': ale#Escape(ale#fixers#jq#GetExecutable(a:buffer))
\ . ' . ' . l:options,
\ . ' ' . l:filters . ' '
\ . l:options,
\}
endfunction