mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-10 14:31:52 +08:00
Merge pull request #2245 from andrewimeson/adi/add-ksh-support
Add better ksh support
This commit is contained in:
@@ -9,7 +9,7 @@ function! ale#handlers#sh#GetShellType(buffer) abort
|
|||||||
" Remove options like -e, etc.
|
" Remove options like -e, etc.
|
||||||
let l:command = substitute(l:bang_line, ' --\?[a-zA-Z0-9]\+', '', 'g')
|
let l:command = substitute(l:bang_line, ' --\?[a-zA-Z0-9]\+', '', 'g')
|
||||||
|
|
||||||
for l:possible_shell in ['bash', 'dash', 'ash', 'tcsh', 'csh', 'zsh', 'sh']
|
for l:possible_shell in ['bash', 'dash', 'ash', 'tcsh', 'csh', 'zsh', 'ksh', 'sh']
|
||||||
if l:command =~# l:possible_shell . '\s*$'
|
if l:command =~# l:possible_shell . '\s*$'
|
||||||
return l:possible_shell
|
return l:possible_shell
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -52,11 +52,27 @@ Execute(zsh should be detected appropriately):
|
|||||||
Given(A file with a csh hash bang and arguments):
|
Given(A file with a csh hash bang and arguments):
|
||||||
#!/usr/bin/env csh -eu --foobar
|
#!/usr/bin/env csh -eu --foobar
|
||||||
|
|
||||||
Execute(zsh should be detected appropriately):
|
Execute(csh should be detected appropriately):
|
||||||
AssertEqual 'csh', ale#handlers#sh#GetShellType(bufnr(''))
|
AssertEqual 'csh', ale#handlers#sh#GetShellType(bufnr(''))
|
||||||
AssertEqual 'csh', ale_linters#sh#shell#GetExecutable(bufnr(''))
|
AssertEqual 'csh', ale_linters#sh#shell#GetExecutable(bufnr(''))
|
||||||
AssertEqual 'csh', ale_linters#sh#shellcheck#GetDialectArgument(bufnr(''))
|
AssertEqual 'csh', ale_linters#sh#shellcheck#GetDialectArgument(bufnr(''))
|
||||||
|
|
||||||
|
Given(A file with a ksh hashbang):
|
||||||
|
#!/bin/ksh
|
||||||
|
|
||||||
|
Execute(/bin/ksh should be detected appropriately):
|
||||||
|
AssertEqual 'ksh', ale#handlers#sh#GetShellType(bufnr(''))
|
||||||
|
AssertEqual 'ksh', ale_linters#sh#shell#GetExecutable(bufnr(''))
|
||||||
|
AssertEqual 'ksh', ale_linters#sh#shellcheck#GetDialectArgument(bufnr(''))
|
||||||
|
|
||||||
|
Given(A file with a ksh as an argument to env):
|
||||||
|
#!/usr/bin/env ksh
|
||||||
|
|
||||||
|
Execute(ksh should be detected appropriately):
|
||||||
|
AssertEqual 'ksh', ale#handlers#sh#GetShellType(bufnr(''))
|
||||||
|
AssertEqual 'ksh', ale_linters#sh#shell#GetExecutable(bufnr(''))
|
||||||
|
AssertEqual 'ksh', ale_linters#sh#shellcheck#GetDialectArgument(bufnr(''))
|
||||||
|
|
||||||
Given(A file with a sh hash bang and arguments):
|
Given(A file with a sh hash bang and arguments):
|
||||||
#!/usr/bin/env sh -eu --foobar
|
#!/usr/bin/env sh -eu --foobar
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user