git-vogue 0.1.0.3 → 0.1.0.4
raw patch · 4 files changed
+30/−3 lines, 4 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Git.Vogue: disabledPlugins :: (Monad m, Functor m, MonadIO m) => m [String]
Files
- README.md +10/−1
- git-vogue.cabal +1/−1
- lib/Git/Vogue.hs +10/−0
- src/git-vogue.hs +9/−1
README.md view
@@ -45,12 +45,21 @@ Running `git-vogue plugins` will show you the libexec directory in which git-vogue will discover plugins. -Should one or more plugins annoy you, you may disable it by setting it+Should one or more plugins annoy you, you may disable it globally by setting it non-executable: ```bash chmod -x .cabal/libexec/git-vogue/git-vogue-stylish ```++Alternatively you can disable plugins on a per-repository, per-user, or+per-system basis by adding the file name to the `vogue.disable` key in your git+configuration:++````bash+git config --local --add vogue.disable git-vogue-a-plugin+git config --global --add vogue.disable git-vogue-another-plugin+```` A more sophisticated interface to plugin manipulation is planned.
git-vogue.cabal view
@@ -1,5 +1,5 @@ name: git-vogue-version: 0.1.0.3+version: 0.1.0.4 synopsis: A framework for pre-commit checks. description: Make your Haskell git repositories fashionable. homepage: https://github.com/anchor/git-vogue
lib/Git/Vogue.hs view
@@ -18,6 +18,7 @@ module Git.Vogue where import Control.Applicative+import Control.Exception import Control.Monad import Control.Monad.IO.Class import Control.Monad.Reader@@ -190,3 +191,12 @@ liftIO . putStr $ "git-vogue knows about the following plugins:\n\n" <> unlines (fmap (('\t':) . unPlugin) plugins)++-- | Get list of disabled plugins from git configuration.+disabledPlugins+ :: (Monad m, Functor m, MonadIO m)+ => m [String]+disabledPlugins = lines <$> liftIO (readConfig `catch` none)+ where+ readConfig = readProcess "git" ["config", "--get-all", "vogue.disable"] ""+ none (SomeException _) = return []
src/git-vogue.hs view
@@ -75,8 +75,12 @@ let directories = splitOn ":" path <> [libexec] -- Find all executables in the directories in path.- (fmap . fmap) fromString+ plugins <- (fmap . fmap) fromString (traverse ls directories >>= filterM isExecutable . concat)++ -- Filter out disabled plugins.+ disabled_plugins <- disabledPlugins+ return . filter (not . pluginIn disabled_plugins) $ plugins where ls :: FilePath -> IO [FilePath] ls p = do@@ -87,6 +91,10 @@ isExecutable :: FilePath -> IO Bool isExecutable = fmap executable . getPermissions++ pluginIn :: [String] -> Plugin -> Bool+ pluginIn disabled_plugins p =+ (takeBaseName . unPlugin $ p) `elem` disabled_plugins -- | Parse the command line and run the command. main :: IO ()