Cabal-1.3.4: A framework for packaging Haskell softwareContentsIndex
Distribution.Simple.Command
Portabilityportable
Stabilityalpha
MaintainerDuncan Coutts <duncan@haskell.org>
Contents
Command interface
Constructing commands
Associating actions with commands
Running commands
Description
Explanation: Data types and parser for the standard command-line setup.
Synopsis
data CommandUI flags = CommandUI {
commandName :: String
commandSynopsis :: String
commandUsage :: (String -> String)
commandDescription :: (Maybe (String -> String))
commandDefaultFlags :: flags
commandOptions :: (ShowOrParseArgs -> [Option flags])
}
commandShowOptions :: CommandUI flags -> flags -> [String]
data ShowOrParseArgs
= ShowArgs
| ParseArgs
makeCommand :: String -> String -> Maybe (String -> String) -> flags -> (ShowOrParseArgs -> [Option flags]) -> CommandUI flags
data Option a
option :: [Char] -> [String] -> String -> c -> d -> (c -> d -> ArgDescr a) -> Option a
data ArgDescr a
noArg :: Monoid a => a -> (a -> Bool) -> (b -> a) -> (a -> b -> b) -> ArgDescr b
reqArg :: Monoid a => String -> (String -> a) -> (a -> [String]) -> (b -> a) -> (a -> b -> b) -> ArgDescr b
optArg :: Monoid a => String -> (Maybe String -> a) -> (a -> [Maybe String]) -> (b -> a) -> (a -> b -> b) -> ArgDescr b
data Command action
commandAddAction :: CommandUI flags -> (flags -> [String] -> action) -> Command action
data CommandParse flags
= CommandHelp (String -> String)
| CommandList [String]
| CommandErrors [String]
| CommandReadyToGo flags
commandsRun :: CommandUI a -> [Command action] -> [String] -> CommandParse (a, CommandParse action)
Command interface
data CommandUI flags
Constructors
CommandUI
commandName :: StringThe name of the command as it would be entered on the command line. For example "build".
commandSynopsis :: StringA short, one line description of the command to use in help texts.
commandUsage :: (String -> String)The useage line summary for this command
commandDescription :: (Maybe (String -> String))Additional explanation of the command to use in help texts.
commandDefaultFlags :: flagsInitial / empty flags
commandOptions :: (ShowOrParseArgs -> [Option flags])All the GetOpt options for this command
commandShowOptions :: CommandUI flags -> flags -> [String]
Show flags in the standard long option command line format
Constructing commands
data ShowOrParseArgs
Constructors
ShowArgs
ParseArgs
makeCommand
:: Stringname
-> Stringshort description
-> Maybe (String -> String)long description
-> flagsinitial/empty flags
-> (ShowOrParseArgs -> [Option flags])options
-> CommandUI flags
Make a Command from standard GetOpt options.
data Option a
option :: [Char] -> [String] -> String -> c -> d -> (c -> d -> ArgDescr a) -> Option a
data ArgDescr a
noArg :: Monoid a => a -> (a -> Bool) -> (b -> a) -> (a -> b -> b) -> ArgDescr b
reqArg :: Monoid a => String -> (String -> a) -> (a -> [String]) -> (b -> a) -> (a -> b -> b) -> ArgDescr b
optArg :: Monoid a => String -> (Maybe String -> a) -> (a -> [Maybe String]) -> (b -> a) -> (a -> b -> b) -> ArgDescr b
Associating actions with commands
data Command action
commandAddAction :: CommandUI flags -> (flags -> [String] -> action) -> Command action
Running commands
data CommandParse flags
Constructors
CommandHelp (String -> String)
CommandList [String]
CommandErrors [String]
CommandReadyToGo flags
show/hide Instances
commandsRun :: CommandUI a -> [Command action] -> [String] -> CommandParse (a, CommandParse action)
Produced by Haddock version 0.9