Fix bug in `ppUsageWithHelp` and some mistakes in docs

pull/5/head
Lennart Spitzner 2017-11-13 21:18:09 +01:00
parent 728cc8641d
commit c4f930f3db
2 changed files with 6 additions and 6 deletions

View File

@ -104,7 +104,7 @@ type CmdParser f out = Free (CmdParserF f out)
-- | A representation/description of a command parser built via the
-- 'CmdParser' monad. Can be transformed into a pretty Doc to display
-- as usage/help via 'ppUsage' and related functions.
-- as usage/help via 'UI.Butcher.Monadic.Pretty.ppUsage' and related functions.
--
-- Note that there is the '_cmd_out' accessor that contains @Maybe out@ which
-- might be useful after successful parsing.

View File

@ -56,9 +56,9 @@ import UI.Butcher.Monadic.Internal.Core
-- | ppUsage exampleDesc yields:
--
-- > playground [--short] NAME [version | help]
-- > example [--short] NAME [version | help]
ppUsage :: CommandDesc a -> PP.Doc
ppUsage (CommandDesc mParent _help _syn parts out children) = pparents mParent
ppUsage (CommandDesc mParent _syn _help parts out children) = pparents mParent
<+> PP.sep [PP.fsep partDocs, subsDoc]
where
pparents :: Maybe (Maybe String, CommandDesc out) -> PP.Doc
@ -79,12 +79,12 @@ ppUsage (CommandDesc mParent _help _syn parts out children) = pparents mParent
-- | ppUsageWithHelp exampleDesc yields:
--
-- > playground [--short] NAME
-- > [version | help]: a simple butcher example program
-- > example [--short] NAME
-- > [version | help]: a simple butcher example program
--
-- And yes, the line break is not optimal in this instance with default print.
ppUsageWithHelp :: CommandDesc a -> PP.Doc
ppUsageWithHelp (CommandDesc mParent help _syn parts out children) =
ppUsageWithHelp (CommandDesc mParent _syn help parts out children) =
pparents mParent <+> PP.fsep (partDocs ++ [subsDoc]) PP.<> helpDoc
where
pparents :: Maybe (Maybe String, CommandDesc out) -> PP.Doc