mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 07:09:28 +03:00
;doc: cli: simplify, use generic help flags again
This commit is contained in:
parent
e7b60be4b0
commit
311be367b0
@ -131,8 +131,8 @@ General output/reporting flags (supported by some commands):
|
||||
General help flags:
|
||||
-h --help show command line help
|
||||
--tldr show command examples with tldr
|
||||
--info show the hledger manual with info
|
||||
--man show the hledger manual with man
|
||||
--info show the manual with info
|
||||
--man show the manual with man
|
||||
--version show version information
|
||||
```
|
||||
}} )m4_dnl
|
||||
|
@ -80,22 +80,13 @@ uimode =
|
||||
[flagNone ["future"] (setboolopt "forecast") "old flag, use --forecast instead"
|
||||
,flagNone ["menu"] (setboolopt "menu") "old flag, menu screen is now the default"
|
||||
]
|
||||
,groupNamed = mkgeneralflagsgroups1 uihelpflags
|
||||
,groupNamed = mkgeneralflagsgroups1 helpflags
|
||||
}
|
||||
,modeHelpSuffix=[
|
||||
-- "Reads your ~/.hledger.journal file, or another specified by $LEDGER_FILE or -f, and starts the full-window TUI."
|
||||
]
|
||||
}
|
||||
|
||||
uihelpflags :: [Flag RawOpts]
|
||||
uihelpflags = [
|
||||
flagNone ["help","h"] (setboolopt "help") "show command line help"
|
||||
,flagNone ["tldr"] (setboolopt "tldr") "show command examples with tldr"
|
||||
,flagNone ["info"] (setboolopt "info") "show the hledger-ui manual with info"
|
||||
,flagNone ["man"] (setboolopt "man") "show the hledger-ui manual with man"
|
||||
,flagNone ["version"] (setboolopt "version") "show version information"
|
||||
]
|
||||
|
||||
-- hledger-ui options, used in hledger-ui and above
|
||||
data UIOpts = UIOpts
|
||||
{ uoWatch :: Bool
|
||||
|
@ -113,20 +113,11 @@ webmode =
|
||||
Group
|
||||
{ groupUnnamed = webflags
|
||||
, groupHidden = hiddenflags
|
||||
, groupNamed = mkgeneralflagsgroups1 webhelpflags
|
||||
, groupNamed = mkgeneralflagsgroups1 helpflags
|
||||
}
|
||||
, modeHelpSuffix = []
|
||||
}
|
||||
|
||||
webhelpflags :: [Flag RawOpts]
|
||||
webhelpflags = [
|
||||
flagNone ["help","h"] (setboolopt "help") "show command line help"
|
||||
,flagNone ["tldr"] (setboolopt "tldr") "show command examples with tldr"
|
||||
,flagNone ["info"] (setboolopt "info") "show the hledger-web manual with info"
|
||||
,flagNone ["man"] (setboolopt "man") "show the hledger-web manual with man"
|
||||
,flagNone ["version"] (setboolopt "version") "show version information"
|
||||
]
|
||||
|
||||
-- hledger-web options, used in hledger-web and above
|
||||
data WebOpts = WebOpts
|
||||
{ serve_ :: !Bool
|
||||
|
@ -317,7 +317,7 @@ isValue "-" = True
|
||||
isValue ('-':_) = False
|
||||
isValue _ = True
|
||||
|
||||
flagstomove = inputflags ++ reportflags ++ clihelpflags
|
||||
flagstomove = inputflags ++ reportflags ++ helpflags
|
||||
noargflagstomove = concatMap flagNames (filter ((==FlagNone).flagInfo) flagstomove)
|
||||
-- silly special case: if someone is abbreviating --tldr, make sure it works right when written before COMMAND
|
||||
-- (not needed for --info, --man, --version since their abbreviations are ambiguous)
|
||||
|
@ -21,7 +21,6 @@ module Hledger.Cli.CliOptions (
|
||||
-- * cmdargs flags & modes
|
||||
inputflags,
|
||||
reportflags,
|
||||
clihelpflags,
|
||||
helpflags,
|
||||
helpflagstitle,
|
||||
detailedversionflag,
|
||||
@ -240,19 +239,16 @@ reportflags = [
|
||||
,flagReq ["debug"] (\s opts -> Right $ setopt "debug" s opts) "[1-9]" "show this level of debug output (default: 1)"
|
||||
]
|
||||
|
||||
clihelpflags :: [Flag RawOpts]
|
||||
clihelpflags = [
|
||||
helpflags :: [Flag RawOpts]
|
||||
helpflags = [
|
||||
flagNone ["help","h"] (setboolopt "help") "show command line help"
|
||||
,flagNone ["tldr"] (setboolopt "tldr") "show command examples with tldr"
|
||||
,flagNone ["info"] (setboolopt "info") "show the hledger manual with info"
|
||||
,flagNone ["man"] (setboolopt "man") "show the hledger manual with man"
|
||||
,flagNone ["info"] (setboolopt "info") "show the manual with info"
|
||||
,flagNone ["man"] (setboolopt "man") "show the manual with man"
|
||||
,flagNone ["version"] (setboolopt "version") "show version information"
|
||||
]
|
||||
-- XXX why are these duplicated in defCommandMode below ?
|
||||
|
||||
-- temp legacy alias
|
||||
helpflags = clihelpflags
|
||||
|
||||
-- | A hidden flag just for the hledger executable.
|
||||
detailedversionflag :: Flag RawOpts
|
||||
detailedversionflag = flagNone ["version+"] (setboolopt "version+") "show version information with extra detail"
|
||||
@ -327,9 +323,9 @@ helpflagstitle = "\nGeneral help flags"
|
||||
|
||||
-- Several subsets of the standard general flags plus CLI help flags, as separate groups.
|
||||
cligeneralflagsgroups1, cligeneralflagsgroups2, cligeneralflagsgroups3 :: [(String, [Flag RawOpts])]
|
||||
cligeneralflagsgroups1 = mkgeneralflagsgroups1 clihelpflags
|
||||
cligeneralflagsgroups2 = mkgeneralflagsgroups2 clihelpflags
|
||||
cligeneralflagsgroups3 = mkgeneralflagsgroups3 clihelpflags
|
||||
cligeneralflagsgroups1 = mkgeneralflagsgroups1 helpflags
|
||||
cligeneralflagsgroups2 = mkgeneralflagsgroups2 helpflags
|
||||
cligeneralflagsgroups3 = mkgeneralflagsgroups3 helpflags
|
||||
|
||||
|
||||
-- cmdargs mode constructors
|
||||
|
@ -36,7 +36,7 @@ helpmode = hledgerCommandMode
|
||||
,flagNone ["m"] (setboolopt "man") "show the manual with man"
|
||||
,flagNone ["p"] (setboolopt "pager") "show the manual with $PAGER or less\n(less is always used if TOPIC is specified)"
|
||||
]
|
||||
[(helpflagstitle, clihelpflags)]
|
||||
[(helpflagstitle, helpflags)]
|
||||
[
|
||||
flagReq ["debug"] (\s opts -> Right $ setopt "debug" s opts) "[N]" "show debug output (levels 1-9, default: 1)"
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user