packages feed

git-fmt 0.1.0.2 → 0.1.0.3

raw patch · 2 files changed

+5/−9 lines, 2 filesdep −exceptions

Dependencies removed: exceptions

Files

git-fmt.cabal view
@@ -1,5 +1,5 @@ name:           git-fmt-version:        0.1.0.2+version:        0.1.0.3  author:         Henry J. Wylde maintainer:     public@hjwylde.com@@ -56,7 +56,6 @@     build-depends:         base == 4.8.*,         directory == 1.2.*,-        exceptions == 0.8.*,         extra == 1.4.*,         filepath == 1.4.*,         json == 0.9.*,
src/Git/Fmt.hs view
@@ -21,7 +21,6 @@ ) where  import Control.Monad-import Control.Monad.Catch      (MonadMask, bracket) import Control.Monad.IO.Class import Control.Monad.Logger @@ -47,9 +46,10 @@     deriving (Eq, Show)  -- | Builds the files according to the options.-handle :: (MonadIO m, MonadLogger m, MonadMask m) => Options -> m ()-handle options = run "git" ["rev-parse", "--show-toplevel"] >>= \dir -> withCurrentDirectory (init dir) $ do-    filePaths <- if null (argFilePaths options) then lines <$> run "git" ["ls-files"] else return (argFilePaths options)+handle :: (MonadIO m, MonadLogger m) => Options -> m ()+handle options = do+    gitDir      <- init <$> run "git" ["rev-parse", "--show-toplevel"]+    filePaths   <- if null (argFilePaths options) then lines <$> run "git" ["ls-files", gitDir] else return (argFilePaths options)      filterM (liftIO . doesFileExist) filePaths >>= mapM_ (\filePath ->         maybe (return ()) (fmt options filePath) (languageOf $ takeExtension filePath))@@ -73,7 +73,4 @@                     $(logInfo) $ pack (filePath ++ ": ugly" ++ if optDryRun options then "" else " (-> pretty)")                      unless (optDryRun options) $ liftIO (writeFile filePath output)--withCurrentDirectory :: (MonadIO m, MonadMask m) => FilePath -> m a -> m a-withCurrentDirectory dir action = bracket (liftIO getCurrentDirectory) (liftIO . setCurrentDirectory) $ \_ -> liftIO (setCurrentDirectory dir) >> action