hsdev-0.1.3.2: Haskell development library and tool with support of autocompletion, symbol info, go to declaration, find references etc.

Safe HaskellNone
LanguageHaskell98

System.Console.Cmd

Synopsis

Documentation

notMatch :: CmdAction a Source

Arguments doesn't match command

failMatch :: String -> CmdAction a Source

Invalid command arguments

runCmd :: Cmd a -> Args -> CmdAction a Source

Run cmd

defaultOpts :: Opts String -> Cmd a -> Cmd a Source

Set default opts

validateArgs :: (Args -> CmdAction ()) -> Cmd a -> Cmd a Source

Validate Args in command

alterArgs :: (Args -> CmdAction Args) -> Cmd a -> Cmd a Source

Alter Args in command

data Cmd a Source

Constructors

Cmd 

Fields

cmdName :: String
 
cmdArgs :: [String]
 
cmdOpts :: [Opt]
 
cmdDesc :: String
 
cmdGetArgs :: Args -> CmdAction Args

Get command arguments from source arguments, by default it cuts command name

cmdAction :: Args -> CmdAction a
 

Instances

cmdAct :: (b -> a) -> b -> CmdAction a Source

Make CmdAction function

cutName :: String -> Args -> CmdAction Args Source

Cut name of command from arguments and checks if it matches

cutName >=> cmdAct act

cmda :: String -> [String] -> [Opt] -> String -> (Args -> CmdAction a) -> Cmd a Source

cmda_ :: String -> [Opt] -> String -> (Opts String -> CmdAction a) -> Cmd a Source

cmd :: String -> [String] -> [Opt] -> String -> (Args -> a) -> Cmd a Source

cmd_ :: String -> [Opt] -> String -> (Opts String -> a) -> Cmd a Source

defCmd :: [String] -> [Opt] -> String -> (Args -> a) -> Cmd a Source

Unnamed command

helpCommand :: String -> (Either String CmdHelp -> a) -> [Cmd a] -> Cmd a Source

Make help command, which will show help on for specified commands

withHelp :: String -> (Either String CmdHelp -> a) -> [Cmd a] -> [Cmd a] Source

Add help command

run :: [Cmd a] -> a -> (String -> a) -> [String] -> a Source

Run commands

runArgs :: [Cmd a] -> a -> (String -> a) -> Args -> a Source

Run commands with parsed args

runOn :: [Cmd a] -> a -> (String -> a) -> (Cmd a -> c -> Args) -> c -> a Source

Run commands with