packages feed

cmdargs 0.7 → 0.8

raw patch · 16 files changed

+148/−71 lines, 16 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ System.Console.CmdArgs.Default: instance Default Int16
+ System.Console.CmdArgs.Default: instance Default Int32
+ System.Console.CmdArgs.Default: instance Default Int64
+ System.Console.CmdArgs.Default: instance Default Int8
+ System.Console.CmdArgs.Default: instance Default Word
+ System.Console.CmdArgs.Default: instance Default Word16
+ System.Console.CmdArgs.Default: instance Default Word32
+ System.Console.CmdArgs.Default: instance Default Word64
+ System.Console.CmdArgs.Default: instance Default Word8
+ System.Console.CmdArgs.Explicit: argRequire :: Arg a -> Bool
- System.Console.CmdArgs.Explicit: Arg :: Update a -> FlagHelp -> Arg a
+ System.Console.CmdArgs.Explicit: Arg :: Update a -> FlagHelp -> Bool -> Arg a
- System.Console.CmdArgs.Explicit: Mode :: Group (Mode a) -> [Name] -> a -> (a -> Either String a) -> (a -> Maybe [String]) -> Help -> [String] -> Maybe (Arg a) -> Group (Flag a) -> Mode a
+ System.Console.CmdArgs.Explicit: Mode :: Group (Mode a) -> [Name] -> a -> (a -> Either String a) -> (a -> Maybe [String]) -> Help -> [String] -> ([Arg a], Maybe (Arg a)) -> Group (Flag a) -> Mode a
- System.Console.CmdArgs.Explicit: modeArgs :: Mode a -> Maybe (Arg a)
+ System.Console.CmdArgs.Explicit: modeArgs :: Mode a -> ([Arg a], Maybe (Arg a))

Files

Main.hs view
@@ -75,7 +75,7 @@   recode :: [String] -> [String]-recode = concatMap f . blanks . takeWhile (not . isPrefixOf "test")+recode = concatMap f . blanks . takeWhile (/= "-- STOP MANUAL")     where         blanks ("":"":xs) = blanks ("":xs)         blanks [""] = []@@ -83,6 +83,7 @@         blanks (x:xs) = x : blanks xs          f x | x == "import System.Console.CmdArgs.Test.Implicit.Util" = []+            | "{-# OPTIONS_GHC " `isPrefixOf` x = []             | "{-# LANGUAGE " `isPrefixOf` x = ["{-# LANGUAGE DeriveDataTypeable #-}"]             | "module System.Console.CmdArgs.Test.Implicit." `isPrefixOf` x = ["module " ++ drop 44 x]         f x = [x]
System/Console/CmdArgs/Default.hs view
@@ -3,6 +3,8 @@ --   To use the default value simply write 'def'. module System.Console.CmdArgs.Default where +import Data.Int+import Data.Word  -- | Class for default values. class Default a where@@ -17,6 +19,16 @@ instance Default Double where def = 0 instance Default [a] where def = [] instance Default (Maybe a) where def = Nothing++instance Default Int8 where def = 0+instance Default Int16 where def = 0+instance Default Int32 where def = 0+instance Default Int64 where def = 0+instance Default Word where def = 0+instance Default Word8 where def = 0+instance Default Word16 where def = 0+instance Default Word32 where def = 0+instance Default Word64 where def = 0  -- EXPANDY: $(2\10 instance ($(1,$ Default a$)) => Default ($(1,$ a$)) where def = ($(1,$ def))) instance (Default a1,Default a2) => Default (a1,a2) where def = (def,def)
System/Console/CmdArgs/Explicit.hs view
@@ -20,11 +20,11 @@     And this can be invoked by:    > main = do-  >     x <- processArgs arguments+  >     xs <- processArgs arguments   >     if ("help","") `elem` xs then   >         print $ helpText def arguments   >      else-  >         print x+  >         print xs      /Groups/: The 'Group' structure allows flags/modes to be grouped for the purpose of     displaying help. When processing command lines, the group structure is ignored.@@ -37,6 +37,15 @@     enter a mode, simply give sub-modes, and leave 'modeArgs' as @Nothing@. Alternatively, if     you want one sub-mode to be selected by default, place all it's flags both in the sub-mode     and the outer mode.++    /Parsing rules/: Command lines are parsed as per most GNU programs. Short arguments single+    letter flags start with @-@, longer flags start with @--@, and everything else is considered+    an argument. Anything after @--@ alone is considered to be an argument. For example:++  > -f --flag argument1 -- --argument2++    This command line passes one single letter flag (@f@), one longer flag (@flag@) and two arguments+    (@argument1@ and @--argument2@). -} module System.Console.CmdArgs.Explicit(     -- * Running command lines
System/Console/CmdArgs/Explicit/Help.hs view
@@ -116,7 +116,7 @@         pre = [Line $ unwords $ take 1 (modeNames x) ++                   ["[COMMAND] ..." | notNullGroup modes] ++                   ["[OPTIONS]" | not $ null $ fromGroup flags] ++-                  map argType (maybeToList $ modeArgs x)] +++                  helpArgs (modeArgs x)] ++               [Line $ "  " ++ modeHelp x | not $ null $ modeHelp x]         suf = space                   ([Line "Flags:" | mixedGroup flags] ++@@ -127,6 +127,12 @@ helpGroup :: (a -> [Text]) -> Group a -> [Text] helpGroup f xs = concatMap f (groupUnnamed xs) ++ concatMap g (groupNamed xs)     where g (a,b) = Line (a ++ ":") : concatMap f b+++helpArgs :: ([Arg a], Maybe (Arg a)) -> [String]+helpArgs (ys,y) = [['['|r] ++ argType x ++ [']'|r] | (i,x) <- zip [0..] xs, let r = req > i]+    where xs = ys ++ maybeToList y+          req = maximum $ 0 : [i | (i,x) <- zip [1..] xs, argRequire x]   helpFlag :: Flag a -> [Text]
System/Console/CmdArgs/Explicit/Process.hs view
@@ -1,4 +1,4 @@-+{-# LANGUAGE RecordWildCards #-} module System.Console.CmdArgs.Explicit.Process(process, processValue, processArgs) where  import System.Console.CmdArgs.Explicit.Type@@ -43,7 +43,7 @@         Ambiguous xs -> Left $ ambiguous "mode" a xs         Found x -> processMode x as         NotFound-            | isNothing (modeArgs m) && args /= [] &&+            | null (fst $ modeArgs m) && isNothing (snd $ modeArgs m) && args /= [] &&               not (null $ modeModes m) && not ("-" `isPrefixOf` concat args)                 -> Left $ missing "mode" $ concatMap modeNames $ modeModes m             | otherwise -> either Left (modeCheck m) $ processFlags m (modeValue m) args@@ -54,15 +54,19 @@   data S a = S-    {val :: a-    ,args :: [String]-    ,errs :: [String]+    {val :: a -- The value you are accumulating+    ,args :: [String] -- The arguments you are processing through+    ,argsCount :: Int -- The number of unnamed arguments you have seen+    ,errs :: [String] -- The errors you have seen     } -stop :: S a -> Maybe (Either String a)-stop s | not $ null $ errs s = Just $ Left $ last $ errs s-       | null $ args s = Just $ Right $ val s-       | otherwise = Nothing+stop :: Mode a -> S a -> Maybe (Either String a)+stop mode S{..}+    | not $ null errs = Just $ Left $ last errs+    | null args = Just $ if argsCount >= mn then Right val else+        Left $ "Expected " ++ (if Just mn == mx then "exactly" else "at least") ++ show mn ++ " unnamed arguments, but got only " ++ show argsCount+    | otherwise = Nothing+    where (mn, mx) = argsRange mode  err :: S a -> String -> S a err s x = s{errs=x:errs s}@@ -74,8 +78,8 @@   processFlags :: Mode a -> a -> [String] -> Either String a-processFlags mode val_ args_ = f $ S val_ args_ []-    where f s = fromMaybe (f $ processFlag mode s) $ stop s+processFlags mode val_ args_ = f $ S val_ args_ 0 []+    where f s = fromMaybe (f $ processFlag mode s) $ stop mode s   pickFlags long mode = [(filter (\x -> (length x > 1) == long) $ flagNames flag,(flagInfo flag,flag)) | flag <- modeFlags mode]@@ -118,19 +122,30 @@   processFlag mode s_@S{args="--":ys} = f s_{args=ys}-    where f s | isJust $ stop s = s+    where f s | isJust $ stop mode s = s               | otherwise = f $ processArg mode s  processFlag mode s = processArg mode s -processArg mode s_@S{args=x:ys} =-    case modeArgs mode of-        Nothing -> err s $ "Unhandled argument, none expected: " ++ x-        Just arg -> case argValue arg x (val s) of+processArg mode s_@S{args=x:ys, argsCount=count} = case argsPick mode count of+    Nothing -> err s $ "Unhandled argument, " ++ str ++ " expected: " ++ x+        where str = if count == 0 then "none" else "at most " ++ show count+    Just arg -> case argValue arg x (val s) of             Left e -> err s $ "Unhandled argument, " ++ e ++ ": " ++ x             Right v -> s{val=v}     where-        s = s_{args=ys}+        s = s_{args=ys, argsCount=count+1}+++-- find the minimum and maximum allowed number of arguments (Nothing=infinite)+argsRange :: Mode a -> (Int, Maybe Int)+argsRange Mode{modeArgs=(lst,end)} = (mn,mx)+    where mn = length $ dropWhile (not . argRequire) $ reverse $ lst ++ maybeToList end+          mx = if isJust end then Nothing else Just $ length lst+++argsPick :: Mode a -> Int -> Maybe (Arg a)+argsPick Mode{modeArgs=(lst,end)} i = if i < length lst then Just $ lst !! i else end   ---------------------------------------------------------------------
System/Console/CmdArgs/Explicit/Type.hs view
@@ -82,7 +82,7 @@     ,modeReform :: a -> Maybe [String] -- ^ Given a value, try to generate the input arguments.     ,modeHelp :: Help -- ^ Help text     ,modeHelpSuffix :: [String] -- ^ A longer help suffix displayed after a mode-    ,modeArgs :: Maybe (Arg a) -- ^ An unnamed argument+    ,modeArgs :: ([Arg a], Maybe (Arg a)) -- ^ The unnamed arguments, a series of arguments, followed optionally by one for all remaining slots     ,modeGroupFlags :: Group (Flag a) -- ^ Groups of flags     } @@ -141,6 +141,7 @@ data Arg a = Arg     {argValue :: Update a -- ^ A way of processing the argument.     ,argType :: FlagHelp -- ^ The type of data for the argument, i.e. FILE\/DIR\/EXT+    ,argRequire :: Bool -- ^ Is at least one of these arguments required, the command line will fail if none are set     }  @@ -189,7 +190,7 @@         ,modeValue = f $ modeValue x         ,modeCheck = \v -> let (a,b) = g v in fmap b $ modeCheck x a         ,modeReform = modeReform x . fst . g-        ,modeArgs = fmap (remap f g) $ modeArgs x+        ,modeArgs = (fmap (remap f g) *** fmap (remap f g)) $ modeArgs x         ,modeGroupFlags = fmap (remap f g) $ modeGroupFlags x}  instance Remap Flag where@@ -207,12 +208,12 @@ -- | Create an empty mode specifying only 'modeValue'. All other fields will usually be populated --   using record updates. modeEmpty :: a -> Mode a-modeEmpty x = Mode mempty [] x Right (const Nothing) "" [] Nothing mempty+modeEmpty x = Mode mempty [] x Right (const Nothing) "" [] ([],Nothing) mempty  -- | Create a mode with a name, an initial value, some help text, a way of processing arguments --   and a list of flags. mode :: Name -> a -> Help -> Arg a -> [Flag a] -> Mode a-mode name value help arg flags = (modeEmpty value){modeNames=[name], modeHelp=help, modeArgs=Just arg, modeGroupFlags=toGroup flags}+mode name value help arg flags = (modeEmpty value){modeNames=[name], modeHelp=help, modeArgs=([],Just arg), modeGroupFlags=toGroup flags}  -- | Create a list of modes, with a program name, an initial value, some help text and the child modes. modes :: String -> a -> Help -> [Mode a] -> Mode a@@ -240,7 +241,7 @@  -- | Create an argument flag, with an update function and the type of the argument. flagArg :: Update a -> FlagHelp -> Arg a-flagArg upd typ = Arg upd typ+flagArg upd typ = Arg upd typ False  -- | Create a boolean flag, with a list of flag names, an update function and some help text. flagBool :: [Name] -> (Bool -> a -> a) -> Help -> Flag a
System/Console/CmdArgs/Implicit/Global.hs view
@@ -9,6 +9,7 @@ import System.Console.CmdArgs.Text import System.Console.CmdArgs.Default +import Control.Arrow import Control.Monad import Data.Char import Data.Function@@ -39,13 +40,13 @@ emptyMode x = x     {modeCheck = \x -> if cmdArgsHasValue x then Left "No mode given and no default mode" else Right x     ,modeGroupFlags = groupUncommonDelete $ modeGroupFlags x-    ,modeArgs=Nothing, modeHelpSuffix=[]}+    ,modeArgs=([],Nothing), modeHelpSuffix=[]}  -- | A mode whose help hides all it's contents zeroMode :: Mode (CmdArgs Any) -> Mode (CmdArgs Any) zeroMode x = x     {modeGroupFlags = groupUncommonHide $ modeGroupFlags x-    ,modeArgs=fmap (\x -> x{argType=""}) $ modeArgs x+    ,modeArgs = let zeroArg x = x{argType=""} in map zeroArg *** fmap zeroArg $ modeArgs x     ,modeHelpSuffix=[]}  @@ -65,7 +66,7 @@  collapseArgs :: [Flag_] -> Mode (CmdArgs Any) -> Mode (CmdArgs Any) collapseArgs [] x = x-collapseArgs xs x = x{modeCheck=chk, modeArgs = Just $ flagArg upd hlp}+collapseArgs xs x = x{modeCheck=chk, modeArgs = ([], Just $ flagArg upd hlp)}     where         argUpd = argValue . flagArg_ 
System/Console/CmdArgs/Implicit/Local.hs view
@@ -196,7 +196,7 @@ toArg :: Flag_ -> Maybe Int -> Flag_ toArg (Flag_ fld x False Nothing Nothing) pos     | null (flagNames x), null (flagHelp x), Just y <- opt $ flagInfo x-    = Arg_ (Arg (flagValue x) (flagType x)) pos y+    = Arg_ (Arg (flagValue x) (flagType x) (isNothing y)) pos y     where         opt FlagReq = Just Nothing         opt (FlagOpt x) = Just (Just x)
System/Console/CmdArgs/Implicit/Reader.hs view
@@ -6,7 +6,10 @@ import qualified Data.Generics.Any.Prelude as A import System.Console.CmdArgs.Explicit import Data.Char+import Data.Int+import Data.Word import Data.List+import Data.Maybe   data Reader = Reader@@ -35,14 +38,15 @@     maybe (Left $ "Could not read as boolean, " ++ show s) (Right . Any) $ parseBool s  -reader_ x-    | ty == "Int" = f "INT" (0::Int)-    | ty == "Integer" = f "INT" (0::Integer)-    | ty == "Float" = f "NUM" (0::Float)-    | ty == "Double" = f "NUM" (0::Double)+reader_ x | res:_ <- catMaybes+    [f "INT" (0::Integer), f "NUM" (0::Float), f "NUM" (0::Double)+    ,f "INT" (0::Int), f "INT" (0::Int8), f "INT" (0::Int16), f "INT" (0::Int32), f "INT" (0::Int64)+    ,f "NAT" (0::Word), f "NAT" (0::Word8), f "NAT" (0::Word16), f "NAT" (0::Word32), f "NAT" (0::Word64)+    ] = Just res     where-        ty = typeName x-        f hlp t = Just $ Reader hlp False 1 $ const $ \s -> case reads s of+        ty = typeOf x+        f hlp t | typeOf (Any t) /= ty = Nothing+                | otherwise = Just $ Reader hlp False 1 $ const $ \s -> case reads s of             [(x,"")] -> Right $ Any $ x `asTypeOf` t             _ -> Left $ "Could not read as type " ++ show (typeOf $ Any t) ++ ", " ++ show s @@ -69,7 +73,7 @@             where ys = filter (isPrefixOf s . fst) xs  -reader_ x | [c] <- ctors x, x <- compose0 x c = do+reader_ x | isAlgType x, [c] <- ctors x, x <- compose0 x c = do     let cs = children x     rs <- mapM reader_ cs     let n = sum $ map readerParts rs
System/Console/CmdArgs/Test/Explicit.hs view
@@ -61,7 +61,7 @@  testModes = do     let m = name "Modes" $ modes "" [] ""-                [(mode "test" ["test"] "" undefined [flagNone ["bob"] ("bob":) ""]){modeArgs=Nothing}+                [(mode "test" ["test"] "" undefined [flagNone ["bob"] ("bob":) ""]){modeArgs=([],Nothing)}                 ,mode "dist" ["dist"] "" (flagArg (upd "") "") [flagNone ["bob"] ("bob":) "", flagReq ["bill"] (upd "bill") "" ""]]     checkGood m [] []     checkFail m ["--bob"]
System/Console/CmdArgs/Test/Implicit/Diffy.hs view
@@ -22,6 +22,8 @@  mode = cmdArgsMode $ modes [create,diff] &= help "Create and compare differences" &= program "diffy" &= summary "Diffy v1.0" +-- STOP MANUAL+ test = do     let Tester{..} = tester "Diffy" mode     fails []
System/Console/CmdArgs/Test/Implicit/HLint.hs view
@@ -49,6 +49,8 @@  mode = cmdArgsMode hlint +-- STOP MANUAL+ test = do     let Tester{..} = tester "HLint" mode     [] === hlint
System/Console/CmdArgs/Test/Implicit/Maker.hs view
@@ -33,6 +33,8 @@  mode = cmdArgsMode $ modes [build,wipe,test_] &= help "Build helper program" &= program "maker" &= summary "Maker v1.0\nMake it" +-- STOP MANUAL+ mode_ = cmdArgsMode_ $ modes_ [build,wipe,test_] += help "Build helper program" += program "maker" += summary "Maker v1.0\nMake it"   where     threads_ = threads := def += help "Number of threads to use" += name "j" += typ "NUM"
System/Console/CmdArgs/Test/Implicit/Tests.hs view
@@ -6,6 +6,7 @@ import System.Console.CmdArgs import System.Console.CmdArgs.Explicit(modeHelp) import System.Console.CmdArgs.Test.Implicit.Util+import Data.Int   test = test1 >> test2 >> test3 >> test4 >> test5 >> test6 >> test7 >> test8 >> test9 >> test10 >>@@ -20,10 +21,10 @@ -- from bug #256 and #231 data Test1     = Test1 {maybeInt :: Maybe Int, listDouble :: [Double], maybeStr :: Maybe String, float :: Float-            ,bool :: Bool, maybeBool :: Maybe Bool, listBool :: [Bool]}+            ,bool :: Bool, maybeBool :: Maybe Bool, listBool :: [Bool], int64 :: Int64}       deriving (Show,Eq,Data,Typeable) -def1 = Test1 def def def (def &= args) def def def+def1 = Test1 def def def (def &= args) def def def def mode1 = cmdArgsMode def1  test1 = do@@ -43,6 +44,7 @@     ["--maybebool"] === def1{maybeBool=Just True}     ["--maybebool=off"] === def1{maybeBool=Just False}     ["--listbool","--listbool=true","--listbool=false"] === def1{listBool=[True,True,False]}+    ["--int64=12"] === def1{int64=12}     fails ["--listbool=fred"]     invalid $ \_ -> def1{listBool = def &= opt "yes"} 
cmdargs.cabal view
@@ -1,7 +1,7 @@ cabal-version:      >= 1.6 build-type:         Simple name:               cmdargs-version:            0.7+version:            0.8 license:            BSD3 license-file:       LICENSE category:           Console@@ -32,6 +32,10 @@ stability:          Beta extra-source-files:     cmdargs.htm++source-repository head+    type:     darcs+    location: http://community.haskell.org/~ndm/darcs/cmdargs/  flag testprog     default: True
cmdargs.htm view
@@ -232,7 +232,7 @@     {report :: [FilePath]     ,hint :: [FilePath]     ,color :: Bool-    ,ignore :: [String]+    ,ignore_ :: [String]     ,show_ :: Bool     ,extension :: [String]     ,language :: [String]@@ -251,7 +251,7 @@     {report = def &= opt "report.html" &= typFile &= help "Generate a report in HTML"     ,hint = def &= typFile &= help "Hint/ignore file to use"     ,color = def &= name "c" &= name "colour" &= help "Color the output (requires ANSI terminal)"-    ,ignore = def &= typ "MESSAGE" &= help "Ignore a particular hint"+    ,ignore_ = def &= typ "MESSAGE" &= help "Ignore a particular hint"     ,show_ = def &= help "Show all ignored ideas"     ,extension = def &= typ "EXT" &= help "File extensions to search (defaults to hs and lhs)"     ,language = def &= name "X" &= typ "LANG" &= help "Language extension (Arrows, NoCPP)"@@ -266,7 +266,7 @@     } &=     verbosity &=     help "Suggest improvements to Haskell source code" &=-    summary "HLint v0.0.0, (C) Neil Mitchell 2006-2010" &=+    summary "HLint v0.0.0, (C) Neil Mitchell" &=     details ["Hlint gives hints on how to improve Haskell code",""             ,"To check all Haskell files in 'src' and generate a report type:","  hlint src --report"] @@ -275,18 +275,15 @@ <!-- END --> <!-- BEGIN help hlint --> <table class='cmdargs'>-<tr><td colspan='3'>HLint v0.0.0, (C) Neil Mitchell 2006-2010</td></tr>+<tr><td colspan='3'>HLint v0.0.0, (C) Neil Mitchell</td></tr> <tr><td colspan='3'>&nbsp;</tr> <tr><td colspan='3'>hlint [OPTIONS] [FILES/DIRS]</td></tr>-<tr><td colspan='3' style='padding-left:1ex;'>Suggest improvements to Haskell source code</td></tr>+<tr><td colspan='3' style='padding-left:2ex;'>Suggest improvements to Haskell source code</td></tr> <tr><td colspan='3'>&nbsp;</tr>-<tr><td style='padding-left:2ex;'>-?</td><td style='padding-left:1ex;'>--help</td><td style='padding-left:2ex;'>Display help message</td></tr>-<tr><td style='padding-left:2ex;'>-V</td><td style='padding-left:1ex;'>--version</td><td style='padding-left:2ex;'>Print version information</td></tr>-<tr><td style='padding-left:2ex;'>-v</td><td style='padding-left:1ex;'>--verbose</td><td style='padding-left:2ex;'>Loud verbosity</td></tr>-<tr><td style='padding-left:2ex;'>-q</td><td style='padding-left:1ex;'>--quiet</td><td style='padding-left:2ex;'>Quiet verbosity</td></tr>-<tr><td style='padding-left:2ex;'>-r</td><td style='padding-left:1ex;'>--report[=FILE]</td><td style='padding-left:2ex;'>Generate a report in HTML (default=report.html)</td></tr>+<tr><td colspan='3'>Common flags:</td></tr>+<tr><td style='padding-left:2ex;'>-r</td><td style='padding-left:1ex;'>--report[=FILE]</td><td style='padding-left:2ex;'>Generate a report in HTML</td></tr> <tr><td style='padding-left:2ex;'>-h</td><td style='padding-left:1ex;'>--hint=FILE</td><td style='padding-left:2ex;'>Hint/ignore file to use</td></tr>-<tr><td style='padding-left:2ex;'>-c</td><td style='padding-left:1ex;'>--color --colour</td><td style='padding-left:2ex;'>Color the output (requires ANSI terminal)</td></tr>+<tr><td style='padding-left:2ex;'>-c</td><td style='padding-left:1ex;'>--colour --color</td><td style='padding-left:2ex;'>Color the output (requires ANSI terminal)</td></tr> <tr><td style='padding-left:2ex;'>-i</td><td style='padding-left:1ex;'>--ignore=MESSAGE</td><td style='padding-left:2ex;'>Ignore a particular hint</td></tr> <tr><td style='padding-left:2ex;'>-s</td><td style='padding-left:1ex;'>--show</td><td style='padding-left:2ex;'>Show all ignored ideas</td></tr> <tr><td style='padding-left:2ex;'>&nbsp;<td style='padding-left:1ex;'>--extension=EXT</td><td style='padding-left:2ex;'>File extensions to search (defaults to hs and lhs)</td></tr>@@ -298,11 +295,15 @@ <tr><td style='padding-left:2ex;'>-d</td><td style='padding-left:1ex;'>--datadir=DIR</td><td style='padding-left:2ex;'>Override the data directory</td></tr> <tr><td style='padding-left:2ex;'>&nbsp;<td style='padding-left:1ex;'>--cpp-define=NAME[=VALUE]</td><td style='padding-left:2ex;'>CPP #define</td></tr> <tr><td style='padding-left:2ex;'>&nbsp;<td style='padding-left:1ex;'>--cpp-include=DIR</td><td style='padding-left:2ex;'>CPP include path</td></tr>+<tr><td style='padding-left:2ex;'>-?</td><td style='padding-left:1ex;'>--help</td><td style='padding-left:2ex;'>Display help message</td></tr>+<tr><td style='padding-left:2ex;'>-V</td><td style='padding-left:1ex;'>--version</td><td style='padding-left:2ex;'>Print version information</td></tr>+<tr><td style='padding-left:2ex;'>-v</td><td style='padding-left:1ex;'>--verbose</td><td style='padding-left:2ex;'>Loud verbosity</td></tr>+<tr><td style='padding-left:2ex;'>-q</td><td style='padding-left:1ex;'>--quiet</td><td style='padding-left:2ex;'>Quiet verbosity</td></tr> <tr><td colspan='3'>&nbsp;</tr>-<tr><td colspan='3' style='padding-left:1ex;'>Hlint gives hints on how to improve Haskell code</td></tr>-<tr><td colspan='3' style='padding-left:1ex;'>&nbsp;</tr>-<tr><td colspan='3' style='padding-left:1ex;'>To check all Haskell files in 'src' and generate a report type:</td></tr>-<tr><td colspan='3' style='padding-left:3ex;'>hlint src --report</td></tr>+<tr><td colspan='3'>Hlint gives hints on how to improve Haskell code</td></tr>+<tr><td colspan='3'>&nbsp;</tr>+<tr><td colspan='3'>To check all Haskell files in 'src' and generate a report type:</td></tr>+<tr><td colspan='3' style='padding-left:2ex;'>hlint src --report</td></tr> </table> <!-- END --> @@ -347,23 +348,21 @@ <table class='cmdargs'> <tr><td colspan='3'>Diffy v1.0</td></tr> <tr><td colspan='3'>&nbsp;</tr>-<tr><td colspan='3'>diffy [OPTIONS]</td></tr>-<tr><td colspan='3' style='padding-left:1ex;'>Create and compare differences</td></tr>+<tr><td colspan='3'>diffy [COMMAND] ... [OPTIONS]</td></tr>+<tr><td colspan='3' style='padding-left:2ex;'>Create and compare differences</td></tr> <tr><td colspan='3'>&nbsp;</tr>-<tr><td colspan='3' style='padding-left:1ex;'>Common flags</td></tr>+<tr><td colspan='3'>Common flags:</td></tr>+<tr><td style='padding-left:2ex;'>-o</td><td style='padding-left:1ex;'>--out=FILE</td><td style='padding-left:2ex;'>Output file</td></tr> <tr><td style='padding-left:2ex;'>-?</td><td style='padding-left:1ex;'>--help</td><td style='padding-left:2ex;'>Display help message</td></tr> <tr><td style='padding-left:2ex;'>-V</td><td style='padding-left:1ex;'>--version</td><td style='padding-left:2ex;'>Print version information</td></tr> <tr><td colspan='3'>&nbsp;</tr> <tr><td colspan='3'>diffy create [OPTIONS]</td></tr>-<tr><td colspan='3' style='padding-left:1ex;'>Create a fingerprint</td></tr>+<tr><td colspan='3' style='padding-left:2ex;'>Create a fingerprint</td></tr> <tr><td colspan='3'>&nbsp;</tr> <tr><td style='padding-left:2ex;'>-s</td><td style='padding-left:1ex;'>--src=DIR</td><td style='padding-left:2ex;'>Source directory</td></tr>-<tr><td style='padding-left:2ex;'>-o</td><td style='padding-left:1ex;'>--out=FILE</td><td style='padding-left:2ex;'>Output file</td></tr> <tr><td colspan='3'>&nbsp;</tr> <tr><td colspan='3'>diffy diff [OPTIONS] OLDFILE NEWFILE</td></tr>-<tr><td colspan='3' style='padding-left:1ex;'>Perform a diff</td></tr>-<tr><td colspan='3'>&nbsp;</tr>-<tr><td style='padding-left:2ex;'>-o</td><td style='padding-left:1ex;'>--out=FILE</td><td style='padding-left:2ex;'>Output file</td></tr>+<tr><td colspan='3' style='padding-left:2ex;'>Perform a diff</td></tr> </table> <!-- END --> @@ -397,21 +396,38 @@ threadsMsg x = x &= help "Number of threads to use" &= name "j" &= typ "NUM"  wipe = Wipe &= help "Clean all build objects"++test_ = Test+    {threads = threadsMsg def+    ,extra = def &= typ "ANY" &= args+    } &= help "Run the test suite"++build = Build+    {threads = threadsMsg def+    ,method = enum+        [Release &= help "Release build"+        ,Debug &= help "Debug build"+        ,Profile &= help "Profile build"]+    ,files = def &= args+    } &= help "Build the project" &= auto++mode = cmdArgsMode $ modes [build,wipe,test_] &= help "Build helper program" &= program "maker" &= summary "Maker v1.0\nMake it" </pre> <!-- END --> <!-- BEGIN help maker --> <table class='cmdargs'> <tr><td colspan='3'>Maker v1.0</td></tr>+<tr><td colspan='3'>Make it</td></tr> <tr><td colspan='3'>&nbsp;</tr>-<tr><td colspan='3'>maker [OPTIONS] </td></tr>-<tr><td colspan='3' style='padding-left:1ex;'>Build helper program</td></tr>+<tr><td colspan='3'>maker [COMMAND] ... [OPTIONS] </td></tr>+<tr><td colspan='3' style='padding-left:2ex;'>Build helper program</td></tr> <tr><td colspan='3'>&nbsp;</tr>-<tr><td colspan='3' style='padding-left:1ex;'>Common flags</td></tr>+<tr><td colspan='3'>Common flags:</td></tr> <tr><td style='padding-left:2ex;'>-?</td><td style='padding-left:1ex;'>--help</td><td style='padding-left:2ex;'>Display help message</td></tr> <tr><td style='padding-left:2ex;'>-V</td><td style='padding-left:1ex;'>--version</td><td style='padding-left:2ex;'>Print version information</td></tr> <tr><td colspan='3'>&nbsp;</tr> <tr><td colspan='3'>maker [build] [OPTIONS] [ITEM]</td></tr>-<tr><td colspan='3' style='padding-left:1ex;'>Build the project</td></tr>+<tr><td colspan='3' style='padding-left:2ex;'>Build the project</td></tr> <tr><td colspan='3'>&nbsp;</tr> <tr><td style='padding-left:2ex;'>-j</td><td style='padding-left:1ex;'>--threads=NUM</td><td style='padding-left:2ex;'>Number of threads to use</td></tr> <tr><td style='padding-left:2ex;'>-r</td><td style='padding-left:1ex;'>--release</td><td style='padding-left:2ex;'>Release build</td></tr>@@ -419,10 +435,10 @@ <tr><td style='padding-left:2ex;'>-p</td><td style='padding-left:1ex;'>--profile</td><td style='padding-left:2ex;'>Profile build</td></tr> <tr><td colspan='3'>&nbsp;</tr> <tr><td colspan='3'>maker wipe [OPTIONS]</td></tr>-<tr><td colspan='3' style='padding-left:1ex;'>Clean all build objects</td></tr>+<tr><td colspan='3' style='padding-left:2ex;'>Clean all build objects</td></tr> <tr><td colspan='3'>&nbsp;</tr> <tr><td colspan='3'>maker test [OPTIONS] [ANY]</td></tr>-<tr><td colspan='3' style='padding-left:1ex;'>Run the test suite</td></tr>+<tr><td colspan='3' style='padding-left:2ex;'>Run the test suite</td></tr> <tr><td colspan='3'>&nbsp;</tr> <tr><td style='padding-left:2ex;'>-j</td><td style='padding-left:1ex;'>--threads=NUM</td><td style='padding-left:2ex;'>Number of threads to use</td></tr> </table>