From eb42ea04e55e812a8b7a5fea163181b1920005c1 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 15 Jun 2017 16:48:03 -0700 Subject: [PATCH] use consistent UPC order for --unmarked/--pending/--cleared (#564) --- bin/hledger-check.hs | 4 ++-- doc/lib.m4 | 8 ++++---- hledger-ui/Hledger/UI/UIState.hs | 16 ++++++++-------- hledger-ui/Hledger/UI/UIUtils.hs | 10 +++++----- hledger/Hledger/Cli/CliOptions.hs | 4 ++-- hledger/doc/queries.m4.md | 4 ++-- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/bin/hledger-check.hs b/bin/hledger-check.hs index df8f7e220..870204180 100755 --- a/bin/hledger-check.hs +++ b/bin/hledger-check.hs @@ -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 diff --git a/doc/lib.m4 b/doc/lib.m4 index dd55794da..72faa6b08 100644 --- a/doc/lib.m4 +++ b/doc/lib.m4 @@ -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 diff --git a/hledger-ui/Hledger/UI/UIState.hs b/hledger-ui/Hledger/UI/UIState.hs index 9962ab84c..2f23abb22 100644 --- a/hledger-ui/Hledger/UI/UIState.hs +++ b/hledger-ui/Hledger/UI/UIState.hs @@ -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_=[]} diff --git a/hledger-ui/Hledger/UI/UIUtils.hs b/hledger-ui/Hledger/UI/UIUtils.hs index 13bfef9fe..a5ca9d771 100644 --- a/hledger-ui/Hledger/UI/UIUtils.hs +++ b/hledger-ui/Hledger/UI/UIUtils.hs @@ -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") diff --git a/hledger/Hledger/Cli/CliOptions.hs b/hledger/Hledger/Cli/CliOptions.hs index 348ca71bf..1a95040fa 100644 --- a/hledger/Hledger/Cli/CliOptions.hs +++ b/hledger/Hledger/Cli/CliOptions.hs @@ -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" diff --git a/hledger/doc/queries.m4.md b/hledger/doc/queries.m4.md index 4d82b8022..f1098a26e 100644 --- a/hledger/doc/queries.m4.md +++ b/hledger/doc/queries.m4.md @@ -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