packages feed

ats-format 0.2.0.29 → 0.2.0.30

raw patch · 4 files changed

+19/−6 lines, 4 files

Files

+ CHANGELOG.md view
@@ -0,0 +1,5 @@+# ats-format++## 0.2.2.30++  * Fix typo in command-line parser
ats-format.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: ats-format-version: 0.2.0.29+version: 0.2.0.30 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2017-2018 Vanessa McHale@@ -15,6 +15,7 @@     man/atsfmt.1     .atsfmt.toml extra-doc-files: README.md+                 CHANGELOG.md  source-repository head     type: darcs
man/atsfmt.1 view
@@ -1,4 +1,4 @@-.\" Automatically generated by Pandoc 2.2.3.2+.\" Automatically generated by Pandoc 2.3 .\" .TH "atsfmt (1)" "" "" "" "" .hy
src/Main.hs view
@@ -22,7 +22,11 @@ import           Text.PrettyPrint.ANSI.Leijen (pretty) import           Text.Toml -data Program = Program { _path :: Maybe FilePath, _inplace :: Bool, _noConfig :: Bool, _defaultConfig :: Bool }+data Program = Program { _path          :: Maybe FilePath+                       , _inplace       :: Bool+                       , _noConfig      :: Bool+                       , _defaultConfig :: Bool+                       }  takeBlock :: String -> (String, String) takeBlock ('%':'}':ys) = ("", ('%':) . ('}':) $ ys)@@ -61,7 +65,7 @@         <> help "Generate default configuration file in the current directory")  versionInfo :: Parser (a -> a)-versionInfo = infoOption ("madlang version: " ++ showVersion version) (short 'V' <> long "version" <> help "Show version")+versionInfo = infoOption ("atsfmt version: " ++ showVersion version) (short 'V' <> long "version" <> help "Show version")  wrapper :: ParserInfo Program wrapper = info (helper <*> versionInfo <*> file)@@ -91,11 +95,14 @@ asBool (VBoolean False) = Just False asBool _                = Nothing +defaults :: (Float, Int, Bool)+defaults = (0.6, 120, False)+ parseToml :: String -> IO (Float, Int, Bool) parseToml p = do     f <- TIO.readFile p     case parseTomlDoc p f of-        Right x -> pure . fromMaybe (0.6, 120, False) $ do+        Right x -> pure . fromMaybe defaults $ do             r <- asFloat =<< HM.lookup "ribbon" x             w <- asInt =<< HM.lookup "width" x             cf <- asBool =<< HM.lookup "clang-format" x@@ -135,4 +142,4 @@ pick (Program Nothing _ nc False)   = (genErr nc . parse) =<< getContents pick (Program Nothing _ _ True)     = defaultConfig ".atsfmt.toml" pick (Program (Just p) True True _) = inplace p (fmap ((<> "\n") . printATS) . fancyError . parse)-pick (Program (Just p) True _ _)    = inplace p ((fmap (<> "\n") . printCustom <=< fancyError) . parse)+pick (Program (Just p) True _ _)    = inplace p (fmap (<> "\n") . printCustom <=< fancyError . parse)