From c4f930f3dbf772d1e9e6f192cad9156ce098014d Mon Sep 17 00:00:00 2001 From: Lennart Spitzner Date: Mon, 13 Nov 2017 21:18:09 +0100 Subject: [PATCH] Fix bug in `ppUsageWithHelp` and some mistakes in docs --- src/UI/Butcher/Monadic/Internal/Types.hs | 2 +- src/UI/Butcher/Monadic/Pretty.hs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/UI/Butcher/Monadic/Internal/Types.hs b/src/UI/Butcher/Monadic/Internal/Types.hs index 079725d..a50d0dc 100644 --- a/src/UI/Butcher/Monadic/Internal/Types.hs +++ b/src/UI/Butcher/Monadic/Internal/Types.hs @@ -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. diff --git a/src/UI/Butcher/Monadic/Pretty.hs b/src/UI/Butcher/Monadic/Pretty.hs index 09e535b..b93420a 100644 --- a/src/UI/Butcher/Monadic/Pretty.hs +++ b/src/UI/Butcher/Monadic/Pretty.hs @@ -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