summaryrefslogtreecommitdiff
path: root/autoload/ale/fixers/terraform.vim
blob: bc05380a9939b54be3a71b77c62cde349b4a7a98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
" Author: dsifford <dereksifford@gmail.com>
" Description: Fixer for terraform and .hcl files

call ale#Set('terraform_fmt_executable', 'terraform')
call ale#Set('terraform_fmt_options', '')

function! ale#fixers#terraform#Fix(buffer) abort
    let l:executable = ale#Var(a:buffer, 'terraform_fmt_executable')
    let l:options = ale#Var(a:buffer, 'terraform_fmt_options')

    return {
    \   'command': ale#Escape(l:executable)
    \       . ' fmt'
    \       . (empty(l:options) ? '' : ' ' . l:options)
    \       . ' -'
    \}
endfunction