Add a newSystemInterface to go with the rest of the new* constructors
This commit is contained in:
parent
d18b2553cf
commit
90d3172dfe
|
@ -396,7 +396,7 @@ ioInterface options files = do
|
||||||
inputs <- mapM normalize files
|
inputs <- mapM normalize files
|
||||||
cache <- newIORef emptyCache
|
cache <- newIORef emptyCache
|
||||||
configCache <- newIORef ("", Nothing)
|
configCache <- newIORef ("", Nothing)
|
||||||
return SystemInterface {
|
return (newSystemInterface :: SystemInterface IO) {
|
||||||
siReadFile = get cache inputs,
|
siReadFile = get cache inputs,
|
||||||
siFindSource = findSourceFile inputs (sourcePaths options),
|
siFindSource = findSourceFile inputs (sourcePaths options),
|
||||||
siGetConfig = getConfig configCache
|
siGetConfig = getConfig configCache
|
||||||
|
|
|
@ -39,11 +39,12 @@ module ShellCheck.Interface
|
||||||
, ColorOption(ColorAuto, ColorAlways, ColorNever)
|
, ColorOption(ColorAuto, ColorAlways, ColorNever)
|
||||||
, TokenComment(tcId, tcComment, tcFix)
|
, TokenComment(tcId, tcComment, tcFix)
|
||||||
, emptyCheckResult
|
, emptyCheckResult
|
||||||
, newParseResult
|
|
||||||
, newAnalysisSpec
|
|
||||||
, newAnalysisResult
|
, newAnalysisResult
|
||||||
|
, newAnalysisSpec
|
||||||
, newFormatterOptions
|
, newFormatterOptions
|
||||||
|
, newParseResult
|
||||||
, newPosition
|
, newPosition
|
||||||
|
, newSystemInterface
|
||||||
, newTokenComment
|
, newTokenComment
|
||||||
, mockedSystemInterface
|
, mockedSystemInterface
|
||||||
, mockRcFile
|
, mockRcFile
|
||||||
|
@ -135,6 +136,14 @@ newParseSpec = ParseSpec {
|
||||||
psShellTypeOverride = Nothing
|
psShellTypeOverride = Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newSystemInterface :: Monad m => SystemInterface m
|
||||||
|
newSystemInterface =
|
||||||
|
SystemInterface {
|
||||||
|
siReadFile = \_ _ -> return $ Left "Not implemented",
|
||||||
|
siFindSource = \_ _ _ name -> return name,
|
||||||
|
siGetConfig = \_ -> return Nothing
|
||||||
|
}
|
||||||
|
|
||||||
-- Parser input and output
|
-- Parser input and output
|
||||||
data ParseSpec = ParseSpec {
|
data ParseSpec = ParseSpec {
|
||||||
psFilename :: String,
|
psFilename :: String,
|
||||||
|
@ -311,7 +320,7 @@ data ColorOption =
|
||||||
|
|
||||||
-- For testing
|
-- For testing
|
||||||
mockedSystemInterface :: [(String, String)] -> SystemInterface Identity
|
mockedSystemInterface :: [(String, String)] -> SystemInterface Identity
|
||||||
mockedSystemInterface files = SystemInterface {
|
mockedSystemInterface files = (newSystemInterface :: SystemInterface Identity) {
|
||||||
siReadFile = rf,
|
siReadFile = rf,
|
||||||
siFindSource = fs,
|
siFindSource = fs,
|
||||||
siGetConfig = const $ return Nothing
|
siGetConfig = const $ return Nothing
|
||||||
|
|
Loading…
Reference in New Issue