fix: cli: don't re-list known installed addons in final section
This commit is contained in:
parent
a7026d694e
commit
16e00062d3
@ -194,6 +194,8 @@ commandsList progversion othercmds =
|
|||||||
-- commands.m4
|
-- commands.m4
|
||||||
-- hledger.m4.md -> Commands
|
-- hledger.m4.md -> Commands
|
||||||
-- commandsFromCommandsList. Only commands should begin with space or plus.
|
-- commandsFromCommandsList. Only commands should begin with space or plus.
|
||||||
|
-- IN PARTICULAR KEEP SYNCED WITH commandsListExtractCommands,
|
||||||
|
-- it needs checking/updating after any wording/layout changes here
|
||||||
"-------------------------------------------------------------------------------"
|
"-------------------------------------------------------------------------------"
|
||||||
,progversion
|
,progversion
|
||||||
,"Usage: hledger CMD [OPTS] [-- ADDONCMDOPTS]"
|
,"Usage: hledger CMD [OPTS] [-- ADDONCMDOPTS]"
|
||||||
@ -283,17 +285,18 @@ commandsList progversion othercmds =
|
|||||||
++ [""]
|
++ [""]
|
||||||
|
|
||||||
-- | Extract just the command names from the default commands list above,
|
-- | Extract just the command names from the default commands list above,
|
||||||
-- (the first word of lines between "Usage:" and "HELP" beginning with a space or plus sign),
|
-- (the first word of lines between "Usage:" and "OTHER" beginning with a space or plus sign),
|
||||||
-- in the order they occur. With a true first argument, extracts only the addon command names.
|
-- in the order they occur. With a true first argument, extracts only the addon command names.
|
||||||
-- Needs to be kept synced with commandsList.
|
|
||||||
commandsListExtractCommands :: Bool -> [String] -> [String]
|
commandsListExtractCommands :: Bool -> [String] -> [String]
|
||||||
commandsListExtractCommands addonsonly l =
|
commandsListExtractCommands addonsonly l =
|
||||||
[ w | c:ws@(d:_) <- takeWhile (not . isInfixOf "HELP") $ dropWhile (not . isInfixOf "Usage:") l
|
[ cmdname | prefixchar:line@(firstchar:_) <-
|
||||||
, c `elem` '+':[' '|not addonsonly]
|
takeWhile (not . isInfixOf "OTHER") $ dropWhile (not . isInfixOf "Usage:") l
|
||||||
, isAlphaNum d
|
, prefixchar `elem` '+':[' '|not addonsonly]
|
||||||
, not $ "://" `isInfixOf` ws
|
, isAlphaNum firstchar
|
||||||
, let w:_ = words ws
|
, not $ "https://" `isInfixOf` line
|
||||||
|
, let cmdname:_ = words line
|
||||||
]
|
]
|
||||||
|
-- KEEP SYNCED WITH commandsList.
|
||||||
|
|
||||||
-- | Canonical names of all commands which have a slot in the commands list, in alphabetical order.
|
-- | Canonical names of all commands which have a slot in the commands list, in alphabetical order.
|
||||||
-- These include the builtin commands and the known addon commands.
|
-- These include the builtin commands and the known addon commands.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user