git-vogue 0.1.0.2 → 0.1.0.3
raw patch · 7 files changed
+69/−11 lines, 7 filesdep ~optparse-applicative
Dependency ranges changed: optparse-applicative
Files
- git-vogue.cabal +8/−6
- lib/Git/Vogue/PluginCommon.hs +56/−0
- src/git-vogue-cabal.hs +1/−1
- src/git-vogue-ghc-mod.hs +1/−1
- src/git-vogue-hlint.hs +1/−1
- src/git-vogue-stylish.hs +1/−1
- src/git-vogue.hs +1/−1
git-vogue.cabal view
@@ -1,5 +1,5 @@ name: git-vogue-version: 0.1.0.2+version: 0.1.0.3 synopsis: A framework for pre-commit checks. description: Make your Haskell git repositories fashionable. homepage: https://github.com/anchor/git-vogue@@ -28,6 +28,7 @@ exposed-modules: Git.Vogue Git.Vogue.Types Git.Vogue.Plugins+ Git.Vogue.PluginCommon other-modules: Paths_git_vogue build-depends: base >=4.7 && <4.8 , MissingH@@ -37,6 +38,7 @@ , formatting , split , text+ , optparse-applicative >= 0.11 , transformers , mtl , unix@@ -53,7 +55,7 @@ , filepath , directory , git-vogue- , optparse-applicative >= 0.11+ , optparse-applicative , split executable git-vogue-cabal@@ -62,7 +64,7 @@ main-is: git-vogue-cabal.hs build-depends: base >=4.7 && <4.8 , Cabal- , optparse-applicative >= 0.11+ , git-vogue , process executable git-vogue-hlint@@ -76,7 +78,7 @@ , cpphs , bifunctors , haskell-src-exts- , optparse-applicative >= 0.11+ , git-vogue , hscolour , process if !flag(gpl)@@ -90,7 +92,7 @@ , Diff , directory , filepath- , optparse-applicative >= 0.11+ , git-vogue , process , strict , stylish-haskell@@ -103,7 +105,7 @@ , Diff , directory , filepath- , optparse-applicative >= 0.11+ , git-vogue , process , strict , ghc-mod
+ lib/Git/Vogue/PluginCommon.hs view
@@ -0,0 +1,56 @@+--+-- Copyright © 2013-2015 Anchor Systems, Pty Ltd and Others+--+-- The code in this file, and the program it is a part of, is+-- made available to you by its authors as open source software:+-- you can redistribute it and/or modify it under the terms of+-- the 3-clause BSD licence.+--++-- | Common helpers for git vogue plugins+module Git.Vogue.PluginCommon+(+ hsFiles,+ getPluginCommand,+ pCommand,+ PluginCommand(..),+) where++import Control.Applicative+import Data.List+import Options.Applicative++-- | Filter the incoming file list by .hs files.+hsFiles :: IO [FilePath]+hsFiles = filter (isSuffixOf ".hs") . lines <$> getContents++-- | Arguments to the plugin+data PluginCommand+ -- | Check the project for problems.+ = CmdCheck+ -- | Fix problems in the project.+ | CmdFix+ -- | Report details.+ | CmdName++-- | Parser for plugin arguments+pluginCommandParser :: Parser PluginCommand+pluginCommandParser = subparser+ ( pCommand "name" CmdName "Get name of plugin"+ <> pCommand "check" CmdCheck "Check for problems"+ <> pCommand "fix" CmdFix "Try to fix problems"+ )++-- | Sub-command helper+pCommand :: String -> a -> String -> Mod CommandFields a+pCommand name ctor desc = command name (info (pure ctor) (progDesc desc))++-- | Get the plugin command requested given a header and a description+getPluginCommand :: String -> String -> IO PluginCommand+getPluginCommand hdr desc = execParser parser+ where+ parser = info (helper <*> pluginCommandParser)+ ( fullDesc+ <> progDesc desc+ <> header hdr)+
src/git-vogue-cabal.hs view
@@ -10,7 +10,6 @@ -- | Description: Check with "cabal check". module Main where -import Common import Control.Monad (unless, when) import Data.Monoid import Distribution.PackageDescription.Check@@ -21,6 +20,7 @@ wrapText) import Distribution.Verbosity (Verbosity, silent)+import Git.Vogue.PluginCommon import System.Exit main :: IO ()
src/git-vogue-ghc-mod.hs view
@@ -10,7 +10,6 @@ -- | Description: Check with "cabal check". module Main where -import Common import Control.Applicative import Data.Char import Data.Foldable@@ -18,6 +17,7 @@ import Data.Maybe import Data.Monoid import Data.Traversable+import Git.Vogue.PluginCommon import Language.Haskell.GhcMod import Prelude hiding (elem) import System.Exit
src/git-vogue-hlint.hs view
@@ -13,12 +13,12 @@ -- | Description: Check with "cabal check". module Main where -import Common import Control.Applicative import Data.Bifunctor import Data.List import Data.Monoid import Data.Traversable+import Git.Vogue.PluginCommon import Language.Haskell.Exts.SrcLoc import Language.Haskell.HLint3 import Language.Preprocessor.Cpphs
src/git-vogue-stylish.hs view
@@ -10,7 +10,6 @@ -- | Description: Check and fix style differences with stylish-haskell module Main where -import Common import Control.Monad import Data.Algorithm.Diff import Data.Algorithm.DiffOutput@@ -18,6 +17,7 @@ import Data.List hiding (and) import Data.Monoid hiding (First) import Data.Traversable+import Git.Vogue.PluginCommon import Language.Haskell.Stylish import Prelude hiding (and) import System.Exit
src/git-vogue.hs view
@@ -25,7 +25,7 @@ import Git.Vogue import Git.Vogue.Types -import Common+import Git.Vogue.PluginCommon import qualified Paths_git_vogue as Paths -- | Parse command-line options.