Switch to butcher-2.0
parent
e03ab8425b
commit
dc008800e7
|
@ -40,7 +40,7 @@ common library
|
||||||
build-depends:
|
build-depends:
|
||||||
, aeson ^>= 2.0.1
|
, aeson ^>= 2.0.1
|
||||||
, base ^>= 4.15.0
|
, base ^>= 4.15.0
|
||||||
, butcher ^>= 1.3.3
|
, butcher ^>= 2.0.0
|
||||||
, bytestring ^>= 0.10.12
|
, bytestring ^>= 0.10.12
|
||||||
, cmdargs ^>= 0.10.21
|
, cmdargs ^>= 0.10.21
|
||||||
, containers ^>= 0.6.4
|
, containers ^>= 0.6.4
|
||||||
|
|
|
@ -114,8 +114,9 @@ extractCommentConfigs anns (TopLevelDeclNameMap declNameMap) = do
|
||||||
, ( "yaml-config-document"
|
, ( "yaml-config-document"
|
||||||
, \s -> "{" `isPrefixOf` dropWhile (== ' ') s
|
, \s -> "{" `isPrefixOf` dropWhile (== ' ') s
|
||||||
, Butcher.addCmdPart (Butcher.varPartDesc "yaml-config-document")
|
, Butcher.addCmdPart (Butcher.varPartDesc "yaml-config-document")
|
||||||
$ fmap (\lconf -> (mempty { _conf_layout = lconf }, ""))
|
$ either
|
||||||
. either (const Nothing) Just
|
(\_ -> Butcher.Failure Nothing)
|
||||||
|
(\lconf -> Butcher.Success (mempty { _conf_layout = lconf }) "")
|
||||||
. Data.Yaml.decodeEither'
|
. Data.Yaml.decodeEither'
|
||||||
. Data.ByteString.Char8.pack
|
. Data.ByteString.Char8.pack
|
||||||
-- TODO: use some proper utf8 encoder instead?
|
-- TODO: use some proper utf8 encoder instead?
|
||||||
|
@ -173,7 +174,7 @@ extractCommentConfigs anns (TopLevelDeclNameMap declNameMap) = do
|
||||||
conf <- configParser
|
conf <- configParser
|
||||||
Butcher.addCmdImpl (InlineConfigTargetModule, conf)
|
Butcher.addCmdImpl (InlineConfigTargetModule, conf)
|
||||||
lineConfigss <- configLiness `forM` \(k, ss) -> do
|
lineConfigss <- configLiness `forM` \(k, ss) -> do
|
||||||
r <- ss `forM` \s -> case Butcher.runCmdParserSimple s parser of
|
r <- ss `forM` \s -> case Butcher.runCmdParserSimpleString s parser of
|
||||||
Left err -> Left $ (err, s)
|
Left err -> Left $ (err, s)
|
||||||
Right c -> Right $ c
|
Right c -> Right $ c
|
||||||
pure (k, r)
|
pure (k, r)
|
||||||
|
|
|
@ -64,7 +64,7 @@ mainWith :: String -> [String] -> IO ()
|
||||||
mainWith progName args =
|
mainWith progName args =
|
||||||
Environment.withProgName progName
|
Environment.withProgName progName
|
||||||
. Environment.withArgs args
|
. Environment.withArgs args
|
||||||
$ mainFromCmdParserWithHelpDesc mainCmdParser
|
$ mainFromCmdParser mainCmdParser
|
||||||
|
|
||||||
helpDoc :: PP.Doc
|
helpDoc :: PP.Doc
|
||||||
helpDoc = PP.vcat $ List.intersperse
|
helpDoc = PP.vcat $ List.intersperse
|
||||||
|
@ -133,8 +133,9 @@ licenseDoc = PP.vcat $ List.intersperse
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
mainCmdParser :: CommandDesc () -> CmdParser Identity (IO ()) ()
|
mainCmdParser :: CmdParser Identity (IO ()) ()
|
||||||
mainCmdParser helpDesc = do
|
mainCmdParser = do
|
||||||
|
helpDesc <- peekCmdDesc
|
||||||
addCmdSynopsis "haskell source pretty printer"
|
addCmdSynopsis "haskell source pretty printer"
|
||||||
addCmdHelp $ helpDoc
|
addCmdHelp $ helpDoc
|
||||||
-- addCmd "debugArgs" $ do
|
-- addCmd "debugArgs" $ do
|
||||||
|
|
Loading…
Reference in New Issue