commander-cli 0.4.0.0 → 0.4.0.1
raw patch · 2 files changed
+44/−6 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- commander-cli.cabal +1/−1
- src/Options/Commander.hs +43/−5
commander-cli.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.4 name: commander-cli-version: 0.4.0.0+version: 0.4.0.1 synopsis: A command line argument/option parser library built around a monadic metaphor description: A command line argument/option parser library built around a monadic metaphor. homepage: https://github.com/SamuelSchlesinger/commander-cli
src/Options/Commander.hs view
@@ -62,14 +62,40 @@ -} module Options.Commander ( -- ** Parsing Arguments and Options+ {- |+ If you want to use a Haskell type as an argument or option, you will need+ to implement the 'Unrender' class. Your type needs to be 'Typeable' for+ the sake of generating documentation.+ -} Unrender(unrender),+ -- ** Defining CLI Programs+ {- |+ To construct a 'ProgramT' (a specification of a CLI program), you can+ have 'arg'uments, 'opt'ions, 'raw' actions in a monad (typically IO),+ 'sub'programs, 'named' programs, you can combine programs together using + '<+>', and you can generate primitive 'usage' information with 'usage'.+ We also have a convenience combinator, 'toplevel', which lets you add+ a name and a help command to your program using the 'usage' combinator.+ -}+ arg, opt, raw, sub, named, flag, toplevel, (<+>), usage,+ -- ** Describing CLI Programs -- ** Run CLI Programs+ {- |+ To run a 'ProgramT' (a specification of a CLI program), you will + need to use 'command' or 'command_'.+ -} command, command_,- -- ** CLI Combinators- arg, opt, raw, sub, named, flag, toplevel, (<+>), usage,- -- ** Type Level CLI Description+ {- |+ Each 'ProgramT' has a type level description, build from these type level+ combinators.+ -} type (&), type (+), Arg, Opt, Named, Raw, Flag,- -- **+ -- ** Interpreting CLI Programs+ {- |+ The 'HasProgram' class forms the backbone of this library, defining the+ syntax for CLI programs using the 'ProgramT' data family, and defining+ the interpretation of all of the various pieces of a CLI.+ -} HasProgram(run, hoist, invocations), ProgramT(ArgProgramT, unArgProgramT, OptProgramT, unOptProgramT,@@ -80,8 +106,18 @@ (:+:) ), -- ** The CommanderT Monad+ {- |+ The 'CommanderT' monad is how your CLI programs are interpreted by 'run'.+ It has the ability to backtrack and it maintains some state.+ -} CommanderT(Action, Defeat, Victory), runCommanderT, initialState, State(State, arguments, options, flags), -- ** Middleware for CommanderT+ {- |+ If you want to modify your interpreted CLI program, in its 'CommanderT'+ form, you can use the concept of 'Middleware'. A number of these are+ provided for debugging complex CLI programs, in case they aren't doing+ what you'd expect.+ -} Middleware, logState, transform, withActionEffects, withDefeatEffects, withVictoryEffects ) where @@ -476,7 +512,9 @@ -> ProgramT (s & p) m a sub = SubProgramT --- | Named command combinator, should only really be used at the top level.+-- | Named command combinator, useful at the top level for naming+-- a program. Typically, the name will be the name or alias of the+-- executable you expect to produce. named :: KnownSymbol s => ProgramT p m a -> ProgramT (Named s & p) m a