diff --git a/hledger/Hledger/Cli/CliOptions.hs b/hledger/Hledger/Cli/CliOptions.hs index d5da171a0..ad062b845 100644 --- a/hledger/Hledger/Cli/CliOptions.hs +++ b/hledger/Hledger/Cli/CliOptions.hs @@ -423,6 +423,7 @@ checkCliOpts opts = -- and returns a CliOpts. Or, with --help or -h present, it prints -- long or short help, and exits the program. -- When --debug is present, also prints some debug output. +-- Note this is not used by the main hledger executable. -- -- The help texts are generated from the mode. -- Long help includes the full usage description generated by cmdargs @@ -456,7 +457,7 @@ getHledgerCliOpts mode' = do (reverse $ dropWhile null $ reverse $ takeWhile (not . ("flags:" `isInfixOf`)) $ lines longhelp) ++ ["" - ," See manual for full detail, including common hledger options." -- TODO + ," See also hledger -h for general hledger options." ] -- | Print debug info about arguments and options if --debug is present. debugArgs :: [String] -> CliOpts -> IO () diff --git a/hledger/Hledger/Cli/Main.hs b/hledger/Hledger/Cli/Main.hs index 77f576361..2ce8af2b3 100644 --- a/hledger/Hledger/Cli/Main.hs +++ b/hledger/Hledger/Cli/Main.hs @@ -210,13 +210,14 @@ noargflagstomove = concatMap flagNames $ filter ((==FlagNone).flagInfo) flagsto reqargflagstomove = -- filter (/= "debug") $ concatMap flagNames $ filter ((==FlagReq ).flagInfo) flagstomove --- | Template for the commands list. Includes an entry for known (or --- hypothetical) builtin and addon commands; these will be filtered --- based on the commands found at runtime. COUNT is replaced with the --- number of commands found. OTHERCMDS is replaced with an entry for --- each unknown addon command found. The command descriptions here --- should be synced with the commands' builtin help and the command --- list in the hledger manual. +-- | Template for the commands list. +-- Includes an entry for all known or hypothetical builtin and addon commands; +-- these will be filtered based on the commands found at runtime. +-- Commands beginning with "hledger" are not filtered ("hledger -h" etc.) +-- COUNT is replaced with the number of commands found. +-- OTHERCMDS is replaced with an entry for each unknown addon command found. +-- The command descriptions here should be synced with each command's builtin help +-- and with hledger manual's command list. commandsListTemplate :: String commandsListTemplate = [here|Commands available (COUNT): @@ -258,9 +259,9 @@ Misc: test run some self tests OTHERCMDS Help: - hledger -h show general usage - hledger CMD -h show command usage help show any of the hledger manuals in various formats + hledger CMD -h show command usage + hledger -h show general usage |] knownCommands :: [String] @@ -280,6 +281,7 @@ printCommandsList addonsFound = putStr commandsList commandsFound = builtinCommandNames ++ addonsFound unknownCommandsFound = addonsFound \\ knownCommands + adjustline l | " hledger " `isPrefixOf` l = [l] adjustline (' ':l) | not $ w `elem` commandsFound = [] where w = takeWhile (not . (`elem` "| ")) l adjustline l = [l]