packages feed

git-fmt 0.3.0.2 → 0.3.0.3

raw patch · 5 files changed

+30/−34 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Omnifmt.Config: instance Data.Aeson.Types.Class.FromJSON Omnifmt.Config.Config
- Omnifmt.Config: instance Data.Aeson.Types.Class.FromJSON Omnifmt.Config.Program
+ Omnifmt.Config: instance Data.Aeson.Types.FromJSON.FromJSON Omnifmt.Config.Config
+ Omnifmt.Config: instance Data.Aeson.Types.FromJSON.FromJSON Omnifmt.Config.Program
+ Omnifmt.Exit: panic :: (MonadError ExitCode m, MonadIO m, MonadLogger m) => String -> m a
+ Omnifmt.Exit: panic_ :: (MonadIO m, MonadLogger m) => String -> m a
+ Omnifmt.Exit: runPanic :: MonadIO m => ExceptT ExitCode m a -> m a
+ Omnifmt.Process: runCommand :: (MonadIO m, MonadLogger m) => String -> m (ExitCode, String, String)
+ Omnifmt.Process: runCommand_ :: (MonadError ExitCode m, MonadIO m, MonadLogger m) => String -> m String
+ Omnifmt.Process: runCreateProcess :: (MonadIO m, MonadLogger m) => CreateProcess -> String -> m (ExitCode, String, String)
+ Omnifmt.Process: runCreateProcess_ :: (MonadError ExitCode m, MonadIO m, MonadLogger m) => CreateProcess -> String -> m String
+ Omnifmt.Process: runProcess :: (MonadIO m, MonadLogger m) => FilePath -> [String] -> m (ExitCode, String, String)
+ Omnifmt.Process: runProcess_ :: (MonadError ExitCode m, MonadIO m, MonadLogger m) => FilePath -> [String] -> m String

Files

app/Git/Fmt/Options.hs view
@@ -12,7 +12,7 @@  module Git.Fmt.Options (     -- * Options-    Options(..), Chatty(..), Mode(..), Reference,+    Options(..), Chatty(..), Mode(..), Files(..),      -- * Optparse     gitFmtPrefs, gitFmtInfo, gitFmt,@@ -28,13 +28,12 @@  -- | Options. data Options = Options {-        optChatty           :: Chatty,-        optNull             :: Bool,-        optMode             :: Mode,-        optOperateOnTracked :: Bool,-        optOperateOn        :: Reference,-        optThreads          :: Maybe Int,-        argPaths            :: [FilePath]+        optChatty    :: Chatty,+        optNull      :: Bool,+        optMode      :: Mode,+        optOperateOn :: Files,+        optThreads   :: Maybe Int,+        argPaths     :: [FilePath]     }     deriving (Eq, Show) @@ -46,8 +45,9 @@ data Mode = Normal | DryRun     deriving (Eq, Show) --- | Git reference.-type Reference = String+-- | Operation files.+data Files = Tracked | Reference String+    deriving (Eq, Show)  -- | The default preferences. --   Limits the help output to 100 columns.@@ -59,6 +59,10 @@ gitFmtInfo = info (infoOptions <*> gitFmt) fullDesc     where         infoOptions = helper <*> version <*> numericVersion+        helper = abortOption ShowHelpText $ mconcat [+            short 'h', hidden,+            help "Show this help text"+            ]         version = infoOption ("Version " ++ showVersion This.version) $ mconcat [             long "version", short 'V', hidden,             help "Show this binary's version"@@ -72,7 +76,7 @@ gitFmt :: Parser Options gitFmt = Options     <$> (-        flag' Quiet (mconcat [+            flag' Quiet (mconcat [             long "quiet", short 'q', hidden,             help "Be quiet"             ])@@ -90,15 +94,17 @@         value Normal, showDefaultWith $ const "normal",         help "Specify the mode as either `normal' or `dry-run'"         ])-    <*> switch (mconcat [-        long "operate-on-tracked",-        help "Operate on all tracked files (i.e., `git ls-files')"-        ])-    <*> strOption (mconcat [-        long "operate-on", metavar "REF",-        value "head", showDefault,-        help "Operate on all files in the reference (i.e., `git diff REF --name-only')"-        ])+    <*> (+            flag' Tracked (mconcat [+            long "operate-on-tracked",+            help "Operate on all tracked files (i.e., `git ls-files')"+            ])+        <|> Reference <$> strOption (mconcat [+            long "operate-on", metavar "REF",+            value "head", showDefault,+            help "Operate on all files in the reference (i.e., `git diff REF --name-only')"+            ])+        )     <*> natOption (mconcat [         long "threads", metavar "INT",         value Nothing, showDefaultWith $ const "number of processors",
app/Main.hs view
@@ -109,15 +109,9 @@         expandDirectory path = ifM (liftIO $ doesDirectoryExist path) (liftIO $ listFilesRecursive path) (return [path])  initialFilePaths :: (MonadError ExitCode m, MonadIO m, MonadLogger m) => Options -> m [FilePath]-initialFilePaths options-    | optOperateOnTracked options   = trackedFilePaths-    | otherwise                     = refFilePaths $ optOperateOn options--trackedFilePaths :: (MonadError ExitCode m, MonadIO m, MonadLogger m) => m [FilePath]-trackedFilePaths = linesBy (== '\0') <$> runProcess_ "git" ["ls-files", "-z"]--refFilePaths :: (MonadError ExitCode m, MonadIO m, MonadLogger m) => String -> m [FilePath]-refFilePaths ref = linesBy (== '\0') <$> runProcess_ "git" ["diff", ref, "--name-only", "-z"]+initialFilePaths options = linesBy (== '\0') <$> case optOperateOn options of+    Tracked         -> runProcess_ "git" ["ls-files", "-z"]+    Reference ref   -> runProcess_ "git" ["diff", ref, "--name-only", "-z"]  pipeline :: (MonadIO m, MonadLogger m, MonadReader Config m) => Pipe (Status, FilePath, FilePath) (Status, FilePath, FilePath) m () pipeline = checkFileSupported >-> checkFileExists >-> createPrettyFile >-> runProgram >-> checkFilePretty
git-fmt.cabal view
@@ -1,5 +1,5 @@ name:           git-fmt-version:        0.3.0.2+version:        0.3.0.3  author:         Henry J. Wylde maintainer:     public@hjwylde.com
src/Omnifmt/Exit.hs view
@@ -10,8 +10,6 @@ Extra exit utilities. -} -{-# OPTIONS_HADDOCK hide #-}- {-# LANGUAGE FlexibleContexts      #-} {-# LANGUAGE MultiParamTypeClasses #-} 
src/Omnifmt/Process.hs view
@@ -10,8 +10,6 @@ System process utilities. -} -{-# OPTIONS_HADDOCK hide #-}- {-# LANGUAGE FlexibleContexts      #-} {-# LANGUAGE MultiParamTypeClasses #-}