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:
|
General help flags:
|
||||||
-h --help show command line help
|
-h --help show command line help
|
||||||
--tldr show command examples with tldr
|
--tldr show command examples with tldr
|
||||||
--info show the hledger manual with info
|
--info show the manual with info
|
||||||
--man show the hledger manual with man
|
--man show the manual with man
|
||||||
--version show version information
|
--version show version information
|
||||||
```
|
```
|
||||||
}} )m4_dnl
|
}} )m4_dnl
|
||||||
|
@ -80,22 +80,13 @@ uimode =
|
|||||||
[flagNone ["future"] (setboolopt "forecast") "old flag, use --forecast instead"
|
[flagNone ["future"] (setboolopt "forecast") "old flag, use --forecast instead"
|
||||||
,flagNone ["menu"] (setboolopt "menu") "old flag, menu screen is now the default"
|
,flagNone ["menu"] (setboolopt "menu") "old flag, menu screen is now the default"
|
||||||
]
|
]
|
||||||
,groupNamed = mkgeneralflagsgroups1 uihelpflags
|
,groupNamed = mkgeneralflagsgroups1 helpflags
|
||||||
}
|
}
|
||||||
,modeHelpSuffix=[
|
,modeHelpSuffix=[
|
||||||
-- "Reads your ~/.hledger.journal file, or another specified by $LEDGER_FILE or -f, and starts the full-window TUI."
|
-- "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
|
-- hledger-ui options, used in hledger-ui and above
|
||||||
data UIOpts = UIOpts
|
data UIOpts = UIOpts
|
||||||
{ uoWatch :: Bool
|
{ uoWatch :: Bool
|
||||||
|
@ -113,20 +113,11 @@ webmode =
|
|||||||
Group
|
Group
|
||||||
{ groupUnnamed = webflags
|
{ groupUnnamed = webflags
|
||||||
, groupHidden = hiddenflags
|
, groupHidden = hiddenflags
|
||||||
, groupNamed = mkgeneralflagsgroups1 webhelpflags
|
, groupNamed = mkgeneralflagsgroups1 helpflags
|
||||||
}
|
}
|
||||||
, modeHelpSuffix = []
|
, 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
|
-- hledger-web options, used in hledger-web and above
|
||||||
data WebOpts = WebOpts
|
data WebOpts = WebOpts
|
||||||
{ serve_ :: !Bool
|
{ serve_ :: !Bool
|
||||||
|
@ -317,7 +317,7 @@ isValue "-" = True
|
|||||||
isValue ('-':_) = False
|
isValue ('-':_) = False
|
||||||
isValue _ = True
|
isValue _ = True
|
||||||
|
|
||||||
flagstomove = inputflags ++ reportflags ++ clihelpflags
|
flagstomove = inputflags ++ reportflags ++ helpflags
|
||||||
noargflagstomove = concatMap flagNames (filter ((==FlagNone).flagInfo) flagstomove)
|
noargflagstomove = concatMap flagNames (filter ((==FlagNone).flagInfo) flagstomove)
|
||||||
-- silly special case: if someone is abbreviating --tldr, make sure it works right when written before COMMAND
|
-- 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)
|
-- (not needed for --info, --man, --version since their abbreviations are ambiguous)
|
||||||
|
@ -21,7 +21,6 @@ module Hledger.Cli.CliOptions (
|
|||||||
-- * cmdargs flags & modes
|
-- * cmdargs flags & modes
|
||||||
inputflags,
|
inputflags,
|
||||||
reportflags,
|
reportflags,
|
||||||
clihelpflags,
|
|
||||||
helpflags,
|
helpflags,
|
||||||
helpflagstitle,
|
helpflagstitle,
|
||||||
detailedversionflag,
|
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)"
|
,flagReq ["debug"] (\s opts -> Right $ setopt "debug" s opts) "[1-9]" "show this level of debug output (default: 1)"
|
||||||
]
|
]
|
||||||
|
|
||||||
clihelpflags :: [Flag RawOpts]
|
helpflags :: [Flag RawOpts]
|
||||||
clihelpflags = [
|
helpflags = [
|
||||||
flagNone ["help","h"] (setboolopt "help") "show command line help"
|
flagNone ["help","h"] (setboolopt "help") "show command line help"
|
||||||
,flagNone ["tldr"] (setboolopt "tldr") "show command examples with tldr"
|
,flagNone ["tldr"] (setboolopt "tldr") "show command examples with tldr"
|
||||||
,flagNone ["info"] (setboolopt "info") "show the hledger manual with info"
|
,flagNone ["info"] (setboolopt "info") "show the manual with info"
|
||||||
,flagNone ["man"] (setboolopt "man") "show the hledger manual with man"
|
,flagNone ["man"] (setboolopt "man") "show the manual with man"
|
||||||
,flagNone ["version"] (setboolopt "version") "show version information"
|
,flagNone ["version"] (setboolopt "version") "show version information"
|
||||||
]
|
]
|
||||||
-- XXX why are these duplicated in defCommandMode below ?
|
-- XXX why are these duplicated in defCommandMode below ?
|
||||||
|
|
||||||
-- temp legacy alias
|
|
||||||
helpflags = clihelpflags
|
|
||||||
|
|
||||||
-- | A hidden flag just for the hledger executable.
|
-- | A hidden flag just for the hledger executable.
|
||||||
detailedversionflag :: Flag RawOpts
|
detailedversionflag :: Flag RawOpts
|
||||||
detailedversionflag = flagNone ["version+"] (setboolopt "version+") "show version information with extra detail"
|
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.
|
-- Several subsets of the standard general flags plus CLI help flags, as separate groups.
|
||||||
cligeneralflagsgroups1, cligeneralflagsgroups2, cligeneralflagsgroups3 :: [(String, [Flag RawOpts])]
|
cligeneralflagsgroups1, cligeneralflagsgroups2, cligeneralflagsgroups3 :: [(String, [Flag RawOpts])]
|
||||||
cligeneralflagsgroups1 = mkgeneralflagsgroups1 clihelpflags
|
cligeneralflagsgroups1 = mkgeneralflagsgroups1 helpflags
|
||||||
cligeneralflagsgroups2 = mkgeneralflagsgroups2 clihelpflags
|
cligeneralflagsgroups2 = mkgeneralflagsgroups2 helpflags
|
||||||
cligeneralflagsgroups3 = mkgeneralflagsgroups3 clihelpflags
|
cligeneralflagsgroups3 = mkgeneralflagsgroups3 helpflags
|
||||||
|
|
||||||
|
|
||||||
-- cmdargs mode constructors
|
-- cmdargs mode constructors
|
||||||
|
@ -36,7 +36,7 @@ helpmode = hledgerCommandMode
|
|||||||
,flagNone ["m"] (setboolopt "man") "show the manual with man"
|
,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)"
|
,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)"
|
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