git-vogue-0.2.1.1: A framework for pre-commit checks.

Safe HaskellSafe
LanguageHaskell2010

Git.Vogue.PluginCommon

Contents

Description

Common helpers for git vogue plugins

Synopsis

Output

outputGood :: MonadIO m => String -> m () Source

The check went or is going well, this should make the developer happy

outputUnfortunate :: MonadIO m => String -> m () Source

A non-fatal warning of some sort. The developer should be able to ignore this.

outputBad :: MonadIO m => String -> m () Source

If any of these appear, you should probably be exploding and the developer will be sad.

lineWrap :: Int -> String -> String Source

Convenience for line wrapping long lines.

FilePath handling

hsProjects Source

Arguments

:: [FilePath]

Files to be checked

-> [FilePath]

All files

-> Map FilePath [FilePath] 

Find .cabal files in hsFiles and arrange children underneath these "headings".

forProjects :: (MonadIO m, Applicative m) => Map FilePath [FilePath] -> ([FilePath] -> m a) -> m (Map FilePath a) Source

For the given projects, perform the supplied action on each given relative URLS and having set the current directory to the project.

This will also take care of printing out a "Checking project in: " message.

Command line parsing

getPluginCommand :: String -> String -> IO PluginCommand Source

Get the plugin command requested given a header and a description

pureSubCommand :: String -> a -> String -> Mod CommandFields a Source

Sub-command helper

data PluginCommand Source

Arguments to the plugin

Constructors

CmdCheck [FilePath] [FilePath]

Check the project for problems.

CmdFix [FilePath] [FilePath]

Fix problems in the project.

CmdName

Report details.

Utility

forWithKey_ :: Applicative f => Map k v -> (k -> v -> f ()) -> f () Source

Helper for traversing a Map with keys

forWithKey :: Applicative f => Map k v -> (k -> v -> f a) -> f (Map k a) Source