Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Annlix
ShellCheck
提交
4e5d32b0
S
ShellCheck
项目概览
Annlix
/
ShellCheck
与 Fork 源项目一致
Fork自
镜像 / koalaman / ShellCheck
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
ShellCheck
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4e5d32b0
编写于
2月 03, 2014
作者:
V
Vidar Holen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added --version flag
上级
c5141b77
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
13 deletion
+29
-13
ShellCheck.cabal
ShellCheck.cabal
+1
-1
ShellCheck/Analytics.hs
ShellCheck/Analytics.hs
+3
-0
ShellCheck/Data.hs
ShellCheck/Data.hs
+2
-0
shellcheck.hs
shellcheck.hs
+23
-12
未找到文件。
ShellCheck.cabal
浏览文件 @
4e5d32b0
Name: ShellCheck
Version: 0.3.0
Version: 0.3.0
-- Must also be updated in ShellCheck/Data.hs
Synopsis: Shell script analysis tool
License: OtherLicense
License-file: LICENSE
...
...
ShellCheck/Analytics.hs
浏览文件 @
4e5d32b0
...
...
@@ -105,8 +105,11 @@ determineShell (T_Script _ shebang _) = fromMaybe Bash . shellForExecutable $ sh
shellForExecutable
"sh"
=
return
Sh
shellForExecutable
"ash"
=
return
Sh
shellForExecutable
"dash"
=
return
Sh
shellForExecutable
"ksh"
=
return
Ksh
shellForExecutable
"ksh88"
=
return
Ksh
shellForExecutable
"ksh93"
=
return
Ksh
shellForExecutable
"zsh"
=
return
Zsh
shellForExecutable
"bash"
=
return
Bash
shellForExecutable
_
=
Nothing
...
...
ShellCheck/Data.hs
浏览文件 @
4e5d32b0
module
ShellCheck.Data
where
shellcheckVersion
=
"0.3.0"
-- Must also be updated in ShellCheck.cabal
internalVariables
=
[
-- Generic
""
,
"_"
,
"rest"
,
"REST"
,
...
...
shellcheck.hs
浏览文件 @
4e5d32b0
...
...
@@ -22,6 +22,7 @@ import Data.Maybe
import
GHC.Exts
import
GHC.IO.Device
import
Prelude
hiding
(
catch
)
import
ShellCheck.Data
import
ShellCheck.Simple
import
ShellCheck.Analytics
import
System.Console.GetOpt
...
...
@@ -41,7 +42,9 @@ options = [
Option
[
'e'
]
[
"exclude"
]
(
ReqArg
(
Flag
"exclude"
)
"CODE1,CODE2.."
)
"exclude types of warnings"
,
Option
[
's'
]
[
"shell"
]
(
ReqArg
(
Flag
"shell"
)
"SHELLNAME"
)
"Specify dialect (bash,sh,ksh,zsh)"
(
ReqArg
(
Flag
"shell"
)
"SHELLNAME"
)
"Specify dialect (bash,sh,ksh,zsh)"
,
Option
[
'V'
]
[
"version"
]
(
NoArg
$
Flag
"version"
"true"
)
"Print version information"
]
printErr
=
hPutStrLn
stderr
...
...
@@ -61,14 +64,9 @@ instance JSON ShellCheckComment where
parseArguments
argv
=
case
getOpt
Permute
options
argv
of
(
opts
,
files
,
[]
)
->
if
not
$
null
files
then
return
$
Just
(
opts
,
files
)
else
do
printErr
"No files specified.
\n
"
printErr
$
usageInfo
header
options
exitWith
syntaxFailure
(
opts
,
files
,
[]
)
->
do
verifyOptions
opts
files
return
$
Just
(
opts
,
files
)
(
_
,
_
,
errors
)
->
do
printErr
$
(
concat
errors
)
++
"
\n
"
++
usageInfo
header
options
...
...
@@ -268,7 +266,6 @@ main = do
process
Nothing
=
return
False
process
(
Just
(
options
,
files
))
=
do
verifyShellOption
options
let
format
=
fromMaybe
"tty"
$
getOption
options
"format"
in
case
Map
.
lookup
format
formats
of
Nothing
->
do
...
...
@@ -280,10 +277,24 @@ process (Just (options, files)) = do
Just
f
->
do
f
options
files
verifyShellOption
options
=
let
shell
=
getOption
options
"shell"
in
verifyOptions
opts
files
=
do
when
(
isJust
$
getOption
opts
"version"
)
printVersionAndExit
let
shell
=
getOption
opts
"shell"
in
if
isNothing
shell
then
return
()
else
when
(
isNothing
$
shell
>>=
shellForExecutable
)
$
do
printErr
$
"Unknown shell: "
++
(
fromJust
shell
)
exitWith
supportFailure
when
(
null
files
)
$
do
printErr
"No files specified.
\n
"
printErr
$
usageInfo
header
options
exitWith
syntaxFailure
printVersionAndExit
=
do
putStrLn
$
"ShellCheck - shell script analysis tool"
putStrLn
$
"version: "
++
shellcheckVersion
putStrLn
$
"license: GNU Affero General Public License, version 3"
putStrLn
$
"website: http://www.shellcheck.net"
exitWith
ExitSuccess
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录