@@ -36,7 +36,6 @@ import Prelude hiding (any)
3636
3737import Options.Applicative.Common
3838import Options.Applicative.Types
39- import Options.Applicative.Help.Ann
4039import Options.Applicative.Help.Chunk
4140import Options.Applicative.Help.Pretty
4241
@@ -57,7 +56,7 @@ safelast = foldl' (const Just) Nothing
5756
5857-- | Generate description for a single option.
5958optDesc :: ParserPrefs -> OptDescStyle -> ArgumentReachability -> Option a -> (Chunk Doc , Parenthetic )
60- optDesc pprefs style _reachability opt = first (annTrace 2 " optDesc " ) $
59+ optDesc pprefs style _reachability opt =
6160 let names =
6261 sort . optionNames . optMain $ opt
6362 meta =
@@ -96,7 +95,7 @@ optDesc pprefs style _reachability opt = first (annTrace 2 "optDesc") $
9695
9796-- | Generate descriptions for commands.
9897cmdDesc :: ParserPrefs -> Parser a -> [(Maybe String , Chunk Doc )]
99- cmdDesc pprefs = fmap ( fmap (annTrace 2 " cmdDesc " )) <$> mapParser desc
98+ cmdDesc pprefs = mapParser desc
10099 where
101100 desc _ opt =
102101 case optMain opt of
@@ -111,18 +110,18 @@ cmdDesc pprefs = fmap (fmap (annTrace 2 "cmdDesc")) <$> mapParser desc
111110
112111-- | Generate a brief help text for a parser.
113112briefDesc :: ParserPrefs -> Parser a -> Chunk Doc
114- briefDesc = fmap (annTrace 2 " briefDesc " ) . briefDesc' True
113+ briefDesc = briefDesc' True
115114
116115-- | Generate a brief help text for a parser, only including mandatory
117116-- options and arguments.
118117missingDesc :: ParserPrefs -> Parser a -> Chunk Doc
119- missingDesc = fmap (annTrace 2 " missingDesc " ) . briefDesc' False
118+ missingDesc = briefDesc' False
120119
121120-- | Generate a brief help text for a parser, allowing the specification
122121-- of if optional arguments are show.
123122briefDesc' :: Bool -> ParserPrefs -> Parser a -> Chunk Doc
124- briefDesc' showOptional pprefs = fmap (annTrace 2 " briefDesc' " )
125- . wrapOver NoDefault MaybeRequired
123+ briefDesc' showOptional pprefs =
124+ wrapOver NoDefault MaybeRequired
126125 . foldTree pprefs style
127126 . mfilterOptional
128127 . treeMapParser (optDesc pprefs style)
@@ -141,19 +140,15 @@ briefDesc' showOptional pprefs = fmap (annTrace 2 "briefDesc'")
141140-- | Wrap a doc in parentheses or brackets if required.
142141wrapOver :: AltNodeType -> Parenthetic -> (Chunk Doc , Parenthetic ) -> Chunk Doc
143142wrapOver altnode mustWrapBeyond (chunk, wrapping)
144- | chunkIsEffectivelyEmpty chunk =
145- annTrace 3 " wrapOver0" <$> chunk
146- | altnode == MarkDefault =
147- annTrace 3 " wrapOver1" <$> fmap brackets chunk
148- | wrapping > mustWrapBeyond =
149- annTrace 3 " wrapOver2" <$> fmap parens chunk
150- | otherwise =
151- annTrace 3 " wrapOver3" chunk
143+ | chunkIsEffectivelyEmpty chunk = chunk
144+ | altnode == MarkDefault = fmap brackets chunk
145+ | wrapping > mustWrapBeyond = fmap parens chunk
146+ | otherwise = chunk
152147
153148-- Fold a tree of option docs into a single doc with fully marked
154149-- optional areas and groups.
155150foldTree :: ParserPrefs -> OptDescStyle -> OptTree (Chunk Doc , Parenthetic ) -> (Chunk Doc , Parenthetic )
156- foldTree _ _ (Leaf x) = first (annTrace 3 " foldTree1 " )
151+ foldTree _ _ (Leaf x) =
157152 x
158153foldTree prefs s (MultNode xs) =
159154 ( let generous :: Chunk Doc
@@ -179,7 +174,7 @@ foldTree prefs s (MultNode xs) =
179174 leads :: [Chunk Doc ]
180175 leads = fmap pure (pretty " " : repeat (line <> pretty " " ))
181176
182- foldTree prefs s (AltNode b xs) = first (annTrace 3 " foldTree2 " ) $
177+ foldTree prefs s (AltNode b xs) =
183178 (\ x -> (x, NeverRequired ))
184179 . fmap groupOrNestLine
185180 . wrapOver b MaybeRequired
@@ -211,7 +206,7 @@ foldTree prefs s (AltNode b xs) = first (annTrace 3 "foldTree2") $
211206 leads :: [Chunk Doc ]
212207 leads = fmap pure (pretty " " : repeat (line <> pretty " | " ))
213208
214- foldTree prefs s (BindNode x) = first (annTrace 3 " foldTree3 " ) $
209+ foldTree prefs s (BindNode x) =
215210 let rendered =
216211 wrapOver NoDefault NeverRequired (foldTree prefs s x)
217212
@@ -223,17 +218,17 @@ foldTree prefs s (BindNode x) = first (annTrace 3 "foldTree3") $
223218
224219-- | Generate a full help text for a parser
225220fullDesc :: ParserPrefs -> Parser a -> Chunk Doc
226- fullDesc = fmap (annTrace 2 " fullDesc " ) <$> optionsDesc False
221+ fullDesc = optionsDesc False
227222
228223-- | Generate a help text for the parser, showing
229224-- only what is relevant in the "Global options: section"
230225globalDesc :: ParserPrefs -> Parser a -> Chunk Doc
231- globalDesc = fmap (annTrace 2 " globalDesc " ) <$> optionsDesc True
226+ globalDesc = optionsDesc True
232227
233228-- | Common generator for full descriptions and globals
234229optionsDesc :: Bool -> ParserPrefs -> Parser a -> Chunk Doc
235- optionsDesc global pprefs = fmap (annTrace 2 " optionsDesc " )
236- . tabulate (prefTabulateFill pprefs)
230+ optionsDesc global pprefs =
231+ tabulate (prefTabulateFill pprefs)
237232 . catMaybes
238233 . mapParser doc
239234 where
@@ -292,7 +287,7 @@ parserHelp pprefs p =
292287 vcatChunks (snd <$> a)
293288 group_title _ = mempty
294289
295- with_title title = annTrace 1 " with_title " . fmap (string title .$. )
290+ with_title title = fmap (string title .$. )
296291
297292
298293parserGlobals :: ParserPrefs -> Parser a -> ParserHelp
@@ -305,7 +300,7 @@ parserGlobals pprefs p =
305300
306301-- | Generate option summary.
307302parserUsage :: ParserPrefs -> Parser a -> String -> Doc
308- parserUsage pprefs p progn = annTrace 2 " parserUsage " $
303+ parserUsage pprefs p progn =
309304 case prefUsageOverflow pprefs of
310305 UsageOverflowAlign ->
311306 hsep
0 commit comments