imp: cli: end help output with a blank line

This commit is contained in:
Simon Michael 2024-05-29 11:52:53 -10:00
parent c35eed5506
commit 82230e5a1f
3 changed files with 5 additions and 5 deletions

View File

@ -75,7 +75,7 @@ hledgerUiMain = withGhcDebug' $ withProgName "hledger-ui.log" $ do -- force Hle
let copts' = copts{inputopts_=iopts{forecast_=forecast_ iopts <|> Just nulldatespan}}
case True of
_ | boolopt "help" rawopts -> pager (showModeUsage uimode)
_ | boolopt "help" rawopts -> pager $ showModeUsage uimode ++ "\n"
_ | boolopt "info" rawopts -> runInfoForTopic "hledger-ui" Nothing
_ | boolopt "man" rawopts -> runManForTopic "hledger-ui" Nothing
_ | boolopt "version" rawopts -> putStrLn prognameandversion

View File

@ -55,10 +55,10 @@ hledgerWebMain = withGhcDebug' $ do
wopts@WebOpts{cliopts_=copts@CliOpts{debug_, rawopts_}} <- getHledgerWebOpts
when (debug_ > 0) $ printf "%s\n" prognameandversion >> printf "opts: %s\n" (show wopts)
if
| boolopt "help" rawopts_ -> pager (showModeUsage webmode) >> exitSuccess
| boolopt "help" rawopts_ -> pager $ showModeUsage webmode ++ "\n"
| boolopt "info" rawopts_ -> runInfoForTopic "hledger-web" Nothing
| boolopt "man" rawopts_ -> runManForTopic "hledger-web" Nothing
| boolopt "version" rawopts_ -> putStrLn prognameandversion >> exitSuccess
| boolopt "version" rawopts_ -> putStrLn prognameandversion
-- boolopt "binary-filename" rawopts_ -> putStrLn (binaryfilename progname)
| boolopt "test" rawopts_ -> do
-- remove --test and --, leaving other args for hspec

View File

@ -195,13 +195,13 @@ main = withGhcDebug' $ do
isExternalCommand = not (null cmd) && cmd `elem` addons -- probably
isBadCommand = not (null rawcmd) && null cmd
hasVersion = ("--version" `elem`)
printUsage = pager $ showModeUsage $ mainmode addons
printUsage = pager $ showModeUsage (mainmode addons) ++ "\n"
badCommandError = error' ("command "++rawcmd++" is not recognized, run with no command to see a list") >> exitFailure -- PARTIAL:
hasHelpFlag args1 = any (`elem` args1) ["-h","--help"]
hasManFlag args1 = (`elem` args1) "--man"
hasInfoFlag args1 = (`elem` args1) "--info"
f `orShowHelp` mode1
| hasHelpFlag args = pager $ showModeUsage mode1
| hasHelpFlag args = pager $ showModeUsage mode1 ++ "\n"
| hasInfoFlag args = runInfoForTopic "hledger" (headMay $ modeNames mode1)
| hasManFlag args = runManForTopic "hledger" (headMay $ modeNames mode1)
| otherwise = f