Actually print help

master
Lennart Spitzner 2022-01-24 10:51:38 +00:00
parent 5f2b4286ee
commit 725dd6d80b
1 changed files with 4 additions and 3 deletions

View File

@ -338,15 +338,16 @@ main = B.mainFromCmdParser $ do
conflateStderr <- B.addSimpleBoolFlag "" ["conflate-err"] mempty conflateStderr <- B.addSimpleBoolFlag "" ["conflate-err"] mempty
conflateBoth <- B.addSimpleBoolFlag "" ["conflate"] mempty conflateBoth <- B.addSimpleBoolFlag "" ["conflate"] mempty
summarize <- B.addFlagStringParams "s" ["summarize"] "STRING" mempty summarize <- B.addFlagStringParams "s" ["summarize"] "STRING" mempty
section <- B.addSimpleBoolFlag "" ["section"] mempty -- section <- B.addSimpleBoolFlag "" ["section"] mempty
B.reorderStop B.reorderStop
rest <- B.addParamRestOfInput "COMMAND" mempty <&> \case rest <- B.addParamRestOfInput "COMMAND" mempty <&> \case
'-' : '-' : ' ' : r -> r '-' : '-' : ' ' : r -> r
'-' : '-' : r -> r '-' : '-' : r -> r
r -> r r -> r
helpDesc <- B.peekCmdDesc
B.addCmdImpl $ if null rest B.addCmdImpl $ if null rest
then do then do
print "help" print $ B.ppHelpShallow helpDesc
else withConcurrentOutput $ do else withConcurrentOutput $ do
setLocaleEncoding utf8 setLocaleEncoding utf8
termSizeMay <- Ansi.getTerminalSize termSizeMay <- Ansi.getTerminalSize
@ -387,7 +388,7 @@ main = B.mainFromCmdParser $ do
, c_summarize = summarize , c_summarize = summarize
, c_outFile = Nothing , c_outFile = Nothing
, c_errFile = Nothing , c_errFile = Nothing
, c_sectionChar = if section then Just '#' else Nothing , c_sectionChar = Nothing -- if section then Just '#' else Nothing
, c_termWidth = termSizeMay <&> snd , c_termWidth = termSizeMay <&> snd
} }
, s_regions = [line0] , s_regions = [line0]