cmt 0.5.0.0 → 0.6.0.0
raw patch · 3 files changed
+17/−19 lines, 3 filesdep ~attoparsecdep ~file-embeddep ~tastyPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: attoparsec, file-embed, tasty, tasty-expected-failure, tasty-hunit
API changes (from Hackage documentation)
- Cmt.IO.Git: commit :: Text -> IO (Either Text Text)
+ Cmt.IO.Git: commit :: Text -> IO ExitCode
Files
- cmt.cabal +6/−6
- src/Cmt.hs +7/−4
- src/Cmt/IO/Git.hs +4/−9
cmt.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.12 name: cmt-version: 0.5.0.0+version: 0.6.0.0 license: BSD3 license-file: LICENSE copyright: Small Hadron Collider / Mark Wales@@ -40,7 +40,7 @@ default-language: Haskell2010 default-extensions: OverloadedStrings NoImplicitPrelude build-depends:- attoparsec >=0.13.2.2 && <0.14,+ attoparsec >=0.13.2.3 && <0.14, base >=4.7 && <5, classy-prelude >=1.5.0 && <1.6, containers >=0.6.0.1 && <0.7,@@ -78,8 +78,8 @@ base >=4.7 && <5, classy-prelude >=1.5.0 && <1.6, cmt -any,- file-embed >=0.0.11 && <0.1,- tasty ==1.2.*,+ file-embed >=0.0.11.1 && <0.1,+ tasty >=1.2.3 && <1.3, tasty-discover >=4.2.1 && <4.3,- tasty-expected-failure >=0.11.1.1 && <0.12,- tasty-hunit >=0.10.0.1 && <0.11+ tasty-expected-failure >=0.11.1.2 && <0.12,+ tasty-hunit >=0.10.0.2 && <0.11
src/Cmt.hs view
@@ -10,7 +10,7 @@ import Data.Text (stripEnd) import System.Directory (removeFile)-import System.Exit (exitFailure, exitSuccess)+import System.Exit (ExitCode (..), exitFailure, exitSuccess) import Cmt.IO.Config (checkFormat, load, readCfg) import Cmt.IO.Git (commit)@@ -24,6 +24,7 @@ | PreDefined Text Outputs | Continue Outputs+ | Version backup :: FilePath backup = ".cmt.bkp"@@ -35,10 +36,10 @@ send txt = do commited <- commit $ stripEnd txt case commited of- Right msg -> putStrLn msg >> exitSuccess- Left msg -> do+ ExitSuccess -> exitSuccess+ ExitFailure _ -> do writeFile backup (encodeUtf8 txt)- failure msg+ exitFailure display :: Either Text (Config, Outputs) -> IO () display (Left err) = putStrLn err@@ -63,6 +64,7 @@ Just cf -> display $ checkFormat output cf parseArgs :: [Text] -> Next+parseArgs ["-v"] = Version parseArgs ["--prev"] = Previous parseArgs ["-p", name] = PreDefined name [] parseArgs ["-p", name, msg] = PreDefined name [("*", msg)]@@ -78,3 +80,4 @@ Continue output -> readCfg output >>= display Previous -> previous PreDefined name output -> predef name output+ Version -> putStrLn "0.6.0"
src/Cmt/IO/Git.hs view
@@ -8,8 +8,8 @@ import ClassyPrelude -import System.Exit (ExitCode (ExitFailure))-import System.Process (readCreateProcessWithExitCode, shell)+import System.Exit (ExitCode)+import System.Process (readCreateProcessWithExitCode, shell, spawnCommand, waitForProcess) -- copied from https://hackage.haskell.org/package/posix-escape escape :: String -> String@@ -19,15 +19,10 @@ f '\'' = "'\"'\"'" f x = [x] -commit :: Text -> IO (Either Text Text)+commit :: Text -> IO ExitCode commit message = do let msg = "git commit -m" <> escape (unpack message)- (code, out, err) <- readCreateProcessWithExitCode (shell msg) ""- let output = unlines (pack <$> filter (not . null) [out, err])- pure $- case code of- ExitFailure _ -> Left output- _ -> Right output+ waitForProcess =<< spawnCommand msg changed :: IO [Text] changed = do