optparse-declarative-0.2.0: Declarative command line option parser

Safe HaskellNone
LanguageHaskell2010

Options.Declarative

Contents

Description

Declarative options parser

Synopsis

Command type

data Cmd help a Source

Instances

Monad (Cmd help) 
Functor (Cmd help) 
Applicative (Cmd help) 
MonadLogger (Cmd help) 
MonadLoggerIO (Cmd help) 
MonadIO (Cmd help) 
KnownSymbol help => IsCmd (Cmd help ()) 

class IsCmd c Source

Minimal complete definition

runCmd

Instances

IsCmd Group 
(KnownSymbol placeholder, IsCmd c) => IsCmd (Arg placeholder [String] -> c) 
(KnownSymbol placeholder, IsCmd c) => IsCmd (Arg placeholder String -> c) 
(KnownSymbol shortNames, KnownSymbols longNames, KnownSymbol placeholder, KnownSymbol help, ArgRead a, IsCmd c) => IsCmd (Flag shortNames longNames placeholder help a -> c) 
KnownSymbol help => IsCmd (Cmd help ()) 

Argument definition tools

class Option a where Source

Associated Types

type Value a :: * Source

Methods

get :: a -> Value a Source

Instances

Option (Arg _a a) 
ArgRead a => Option (Flag _a _b _c _d a) 

data Flag shortNames longNames placeholder help a Source

Instances

(KnownSymbol shortNames, KnownSymbols longNames, KnownSymbol placeholder, KnownSymbol help, ArgRead a, IsCmd c) => IsCmd (Flag shortNames longNames placeholder help a -> c) 
ArgRead a => Option (Flag _a _b _c _d a) 
type Value (Flag _a _b _c _d a) = Unwrap a 

data Arg placeholder a Source

Instances

(KnownSymbol placeholder, IsCmd c) => IsCmd (Arg placeholder [String] -> c) 
(KnownSymbol placeholder, IsCmd c) => IsCmd (Arg placeholder String -> c) 
Option (Arg _a a) 
type Value (Arg _a a) = a 

Defining argment types

class ArgRead a where Source

Minimal complete definition

Nothing

Associated Types

type Unwrap a :: * Source

Instances

data Def defaultValue a Source

Instances

(KnownSymbol defaultValue, ArgRead a) => ArgRead (Def defaultValue a) 
type Unwrap (Def defaultValue a) = Unwrap a 

Subcommands support

data Group Source

Constructors

Group 

Fields

groupHelp :: String
 
groupCmds :: [SubCmd]
 

Instances

subCmd :: IsCmd c => String -> c -> SubCmd Source

Run a command

run :: IsCmd c => String -> Maybe String -> c -> IO () Source

Run a command with specifying program name and version

run_ :: IsCmd c => c -> IO () Source

Run a command