use consistent UPC order for --unmarked/--pending/--cleared (#564)

This commit is contained in:
Simon Michael 2017-06-15 16:48:03 -07:00
parent cca95d2974
commit eb42ea04e5
6 changed files with 23 additions and 23 deletions

View File

@ -26,9 +26,9 @@ Available options:
--ignore-assertions ignore any balance assertions in the journal
-b,--begin DATE include postings/txns on or after this date
-e,--end DATE include postings/txns before this date
-C,--cleared include only cleared postings/txns
-P,--pending include only pending postings/txns
-U,--unmarked include only unmarked postings/txns
-P,--pending include only pending postings/txns
-C,--cleared include only cleared postings/txns
-R,--real include only non-virtual postings
--sunday weeks start on Sunday
-D,--daily ASSERT assertions that must hold at the end of the day

View File

@ -137,14 +137,14 @@ m4_define({{_reportingoptions_}}, {{
`--date2`
: show, and match with -b/-e/-p/date:, secondary dates instead
`-C --cleared`
: include only cleared postings/txns
`-U --unmarked`
: include only unmarked postings/txns (can combine with -P or -C)
`-P --pending`
: include only pending postings/txns
`-U --unmarked`
: include only unmarked postings/txns
`-C --cleared`
: include only cleared postings/txns
`-R --real`
: include only non-virtual postings

View File

@ -17,20 +17,20 @@ import Hledger.Cli.CliOptions
import Hledger.UI.UITypes
import Hledger.UI.UIOptions
-- | Toggle between showing only cleared items or all items.
toggleCleared :: UIState -> UIState
toggleCleared ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
ui{aopts=uopts{cliopts_=copts{reportopts_=reportOptsToggleStatus Cleared ropts}}}
-- | Toggle between showing only unmarked items or all items.
toggleUnmarked :: UIState -> UIState
toggleUnmarked ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
ui{aopts=uopts{cliopts_=copts{reportopts_=reportOptsToggleStatus Unmarked ropts}}}
-- | Toggle between showing only pending items or all items.
togglePending :: UIState -> UIState
togglePending ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
ui{aopts=uopts{cliopts_=copts{reportopts_=reportOptsToggleStatus Pending ropts}}}
-- | Toggle between showing only unmarked items or all items.
toggleUnmarked :: UIState -> UIState
toggleUnmarked ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
ui{aopts=uopts{cliopts_=copts{reportopts_=reportOptsToggleStatus Unmarked ropts}}}
-- | Toggle between showing only cleared items or all items.
toggleCleared :: UIState -> UIState
toggleCleared ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
ui{aopts=uopts{cliopts_=copts{reportopts_=reportOptsToggleStatus Cleared ropts}}}
reportOptsToggleStatus s ropts
| clearedstatus_ ropts == [s] = ropts{clearedstatus_=[]}

View File

@ -28,10 +28,10 @@ runHelp = runCommand "hledger-ui --help | less" >>= waitForProcess
-- ui
uiShowClearedStatus = map showstatus
uiShowClearedStatus = map showstatus . sort
where
showstatus Cleared = "cleared"
showstatus Pending = "pending"
showstatus Cleared = "cleared"
showstatus Pending = "pending"
showstatus Unmarked = "unmarked"
-- | Draw the help dialog, called when help mode is active.
@ -76,9 +76,9 @@ helpDialog =
,renderKey ("t", "set report period to today")
,str " "
,renderKey ("/", "set a filter query")
,renderKey ("C", "toggle cleared/all")
,renderKey ("P", "toggle pending/all")
,renderKey ("U", "toggle unmarked/all")
,renderKey ("P", "toggle pending/all")
,renderKey ("C", "toggle cleared/all")
,renderKey ("R", "toggle real/all")
,renderKey ("Z", "toggle nonzero/all")
,renderKey ("DEL/BS", "remove filters")

View File

@ -139,9 +139,9 @@ reportflags = [
,flagReq ["period","p"] (\s opts -> Right $ setopt "period" s opts) "PERIODEXP" "set start date, end date, and/or report interval all at once (overrides the flags above)"
,flagNone ["date2"] (setboolopt "date2") "show, and make -b/-e/-p/date: match, secondary dates instead"
,flagNone ["cleared","C"] (setboolopt "cleared") "include only cleared postings/txns"
,flagNone ["unmarked","U"] (setboolopt "unmarked") "include only unmarked postings/txns (can combine with -P or -C)"
,flagNone ["pending","P"] (setboolopt "pending") "include only pending postings/txns"
,flagNone ["unmarked","U"] (setboolopt "unmarked") "include only unmarked postings/txns"
,flagNone ["cleared","C"] (setboolopt "cleared") "include only cleared postings/txns"
,flagNone ["real","R"] (setboolopt "real") "include only non-virtual postings"
,flagReq ["depth"] (\s opts -> Right $ setopt "depth" s opts) "N" "hide accounts/postings deeper than N"
,flagNone ["empty","E"] (setboolopt "empty") "show items with zero amount, normally hidden"

View File

@ -71,8 +71,8 @@ If the `--date2` command line flag is present, this matches [secondary dates](ma
**`real:, real:0`**
: match real or virtual postings respectively
**`status:*, status:!, status:`**
: match cleared, pending, or uncleared/pending transactions respectively
**`status:, status:!, status:*`**
: match unmarked, pending, or cleared transactions respectively
**`tag:REGEX[=REGEX]`**
: match by tag name, and optionally also by tag value. Note a