summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.md7
-rw-r--r--Hledger/UI/AccountsScreen.hs6
-rw-r--r--Hledger/UI/ErrorScreen.hs8
-rw-r--r--Hledger/UI/Main.hs5
-rw-r--r--Hledger/UI/RegisterScreen.hs6
-rw-r--r--Hledger/UI/UIState.hs12
-rw-r--r--hledger-ui.14
-rw-r--r--hledger-ui.cabal8
-rw-r--r--hledger-ui.info2
-rw-r--r--hledger-ui.txt4
10 files changed, 35 insertions, 27 deletions
diff --git a/CHANGES.md b/CHANGES.md
index 33d860b..2951d33 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -9,10 +9,17 @@
User-visible changes in hledger-ui.
See also the hledger changelog.
+# 1.22.2 2021-08-07
+
+- Use hledger 1.22.2.
+
# 1.22.1 2021-08-02
Improvements
+- Document watch mode and its limitations.
+ (#1617, #911, #836)
+
- Allow megaparsec 9.1.
Fixes
diff --git a/Hledger/UI/AccountsScreen.hs b/Hledger/UI/AccountsScreen.hs
index c0df166..6dde7b9 100644
--- a/Hledger/UI/AccountsScreen.hs
+++ b/Hledger/UI/AccountsScreen.hs
@@ -49,7 +49,7 @@ accountsScreen = AccountsScreen{
asInit :: Day -> Bool -> UIState -> UIState
asInit d reset ui@UIState{
- aopts=UIOpts{cliopts_=CliOpts{reportspec_=rspec@ReportSpec{rsOpts=ropts}}},
+ aopts=UIOpts{cliopts_=copts@CliOpts{reportspec_=rspec@ReportSpec{rsOpts=ropts}}},
ajournal=j,
aScreen=s@AccountsScreen{}
} =
@@ -77,7 +77,7 @@ asInit d reset ui@UIState{
as = map asItemAccountName displayitems
-- Further restrict the query based on the current period and future/forecast mode.
- rspec' = rspec{rsQuery=simplifyQuery $ And [rsQuery rspec, periodq, excludeforecastq (forecast_ ropts)]}
+ rspec' = rspec{rsQuery=simplifyQuery $ And [rsQuery rspec, periodq, excludeforecastq (forecast_ $ inputopts_ copts)]}
where
periodq = Date $ periodAsDateSpan $ period_ ropts
-- Except in forecast mode, exclude future/forecast transactions.
@@ -198,7 +198,7 @@ asDraw UIState{aopts=_uopts@UIOpts{cliopts_=copts@CliOpts{reportspec_=rspec}}
-- ,("l", str "list")
,("-+", str "depth")
,("H", renderToggle (not ishistorical) "end-bals" "changes")
- ,("F", renderToggle1 (isJust $ forecast_ ropts) "forecast")
+ ,("F", renderToggle1 (isJust . forecast_ $ inputopts_ copts) "forecast")
--,("/", "filter")
--,("DEL", "unfilter")
--,("ESC", "cancel/top")
diff --git a/Hledger/UI/ErrorScreen.hs b/Hledger/UI/ErrorScreen.hs
index c4edefe..178ddb5 100644
--- a/Hledger/UI/ErrorScreen.hs
+++ b/Hledger/UI/ErrorScreen.hs
@@ -182,13 +182,13 @@ uiReloadJournalIfChanged copts d j ui = do
-- or in the provided UIState's startup options,
-- it is preserved.
enableForecastPreservingPeriod :: UIState -> CliOpts -> CliOpts
-enableForecastPreservingPeriod ui copts@CliOpts{reportspec_=rspec@ReportSpec{rsOpts=ropts}} =
- copts{reportspec_=rspec{rsOpts=ropts{forecast_=mforecast}}}
+enableForecastPreservingPeriod ui copts@CliOpts{inputopts_=iopts} =
+ copts{inputopts_=iopts{forecast_=mforecast}}
where
mforecast = asum [mprovidedforecastperiod, mstartupforecastperiod, mdefaultforecastperiod]
where
- mprovidedforecastperiod = forecast_ ropts
- mstartupforecastperiod = forecast_ $ rsOpts $ reportspec_ $ cliopts_ $ astartupopts ui
+ mprovidedforecastperiod = forecast_ $ inputopts_ copts
+ mstartupforecastperiod = forecast_ $ inputopts_ $ cliopts_ $ astartupopts ui
mdefaultforecastperiod = Just nulldatespan
-- Re-check any balance assertions in the current journal, and if any
diff --git a/Hledger/UI/Main.hs b/Hledger/UI/Main.hs
index 071c98b..be6c1cb 100644
--- a/Hledger/UI/Main.hs
+++ b/Hledger/UI/Main.hs
@@ -8,6 +8,7 @@ Released under GPL version 3 or later.
module Hledger.UI.Main where
+import Control.Applicative ((<|>))
import Control.Concurrent (threadDelay)
import Control.Concurrent.Async (withAsync)
import Control.Monad (forM_, void, when)
@@ -43,11 +44,11 @@ writeChan = BC.writeBChan
main :: IO ()
main = do
- opts@UIOpts{cliopts_=copts@CliOpts{inputopts_=_iopts,reportspec_=rspec@ReportSpec{rsOpts=ropts},rawopts_=rawopts}} <- getHledgerUIOpts
+ opts@UIOpts{cliopts_=copts@CliOpts{inputopts_=iopts,rawopts_=rawopts}} <- getHledgerUIOpts
-- when (debug_ $ cliopts_ opts) $ printf "%s\n" prognameandversion >> printf "opts: %s\n" (show opts)
-- always generate forecasted periodic transactions; their visibility will be toggled by the UI.
- let copts' = copts{reportspec_=rspec{rsOpts=ropts{forecast_=Just $ fromMaybe nulldatespan (forecast_ ropts)}}}
+ let copts' = copts{inputopts_=iopts{forecast_=forecast_ iopts <|> Just nulldatespan}}
case True of
_ | "help" `inRawOpts` rawopts -> putStr (showModeUsage uimode)
diff --git a/Hledger/UI/RegisterScreen.hs b/Hledger/UI/RegisterScreen.hs
index c6aeb39..72d13ad 100644
--- a/Hledger/UI/RegisterScreen.hs
+++ b/Hledger/UI/RegisterScreen.hs
@@ -56,7 +56,7 @@ rsSetAccount a forceinclusive scr@RegisterScreen{} =
rsSetAccount _ _ scr = scr
rsInit :: Day -> Bool -> UIState -> UIState
-rsInit d reset ui@UIState{aopts=_uopts@UIOpts{cliopts_=CliOpts{reportspec_=rspec@ReportSpec{rsOpts=ropts}}}, ajournal=j, aScreen=s@RegisterScreen{..}} =
+rsInit d reset ui@UIState{aopts=_uopts@UIOpts{cliopts_=CliOpts{inputopts_=iopts,reportspec_=rspec@ReportSpec{rsOpts=ropts}}}, ajournal=j, aScreen=s@RegisterScreen{..}} =
ui{aScreen=s{rsList=newitems'}}
where
-- gather arguments and queries
@@ -77,7 +77,7 @@ rsInit d reset ui@UIState{aopts=_uopts@UIOpts{cliopts_=CliOpts{reportspec_=rspec
updateReportSpec ropts' rspec
-- Further restrict the query based on the current period and future/forecast mode.
- q = simplifyQuery $ And [rsQuery rspec', periodq, excludeforecastq (forecast_ ropts)]
+ q = simplifyQuery $ And [rsQuery rspec', periodq, excludeforecastq (forecast_ iopts)]
where
periodq = Date $ periodAsDateSpan $ period_ ropts
-- Except in forecast mode, exclude future/forecast transactions.
@@ -251,7 +251,7 @@ rsDraw UIState{aopts=_uopts@UIOpts{cliopts_=copts@CliOpts{reportspec_=rspec}}
-- ,("l", str "list(-subs)")
,("H", renderToggle (not ishistorical) "historical" "period")
- ,("F", renderToggle1 (isJust $ forecast_ ropts) "forecast")
+ ,("F", renderToggle1 (isJust . forecast_ . inputopts_ $ copts) "forecast")
-- ,("a", "add")
-- ,("g", "reload")
-- ,("q", "quit")
diff --git a/Hledger/UI/UIState.hs b/Hledger/UI/UIState.hs
index 561e93a..e536aad 100644
--- a/Hledger/UI/UIState.hs
+++ b/Hledger/UI/UIState.hs
@@ -7,8 +7,8 @@ module Hledger.UI.UIState
where
import Brick.Widgets.Edit
+import Control.Applicative ((<|>))
import Data.List ((\\), foldl', sort)
-import Data.Maybe (fromMaybe)
import Data.Semigroup (Max(..))
import qualified Data.Text as T
import Data.Text.Zipper (gotoEOL)
@@ -157,19 +157,19 @@ toggleHistorical ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportspec
-- (which are usually but not necessarily future-dated).
-- In normal mode, both of these are hidden.
toggleForecast :: Day -> UIState -> UIState
-toggleForecast d ui@UIState{aopts=UIOpts{cliopts_=copts@CliOpts{reportspec_=ReportSpec{rsOpts=ropts}}}} =
+toggleForecast d ui@UIState{aopts=UIOpts{cliopts_=copts@CliOpts{inputopts_=iopts}}} =
uiSetForecast ui $
- case forecast_ ropts of
+ case forecast_ iopts of
Just _ -> Nothing
- Nothing -> Just $ fromMaybe nulldatespan $ forecastPeriodFromRawOpts d $ rawopts_ copts
+ Nothing -> forecastPeriodFromRawOpts d (rawopts_ copts) <|> Just nulldatespan
-- | Helper: set forecast mode (with the given forecast period) on or off in the UI state.
uiSetForecast :: UIState -> Maybe DateSpan -> UIState
uiSetForecast
- ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportspec_=rspec@ReportSpec{rsOpts=ropts}}}}
+ ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{inputopts_=iopts}}}
mforecast =
-- we assume forecast mode has no effect on ReportSpec's derived fields
- ui{aopts=uopts{cliopts_=copts{reportspec_=rspec{rsOpts=ropts{forecast_=mforecast}}}}}
+ ui{aopts=uopts{cliopts_=copts{inputopts_=iopts{forecast_=mforecast}}}}
-- | Toggle between showing all and showing only real (non-virtual) items.
toggleReal :: UIState -> UIState
diff --git a/hledger-ui.1 b/hledger-ui.1
index 094ad4c..8d51cb9 100644
--- a/hledger-ui.1
+++ b/hledger-ui.1
@@ -1,5 +1,5 @@
-.TH "HLEDGER-UI" "1" "August 2021" "hledger-ui-1.22.1 " "hledger User Manuals"
+.TH "HLEDGER-UI" "1" "August 2021" "hledger-ui-1.22.2 " "hledger User Manuals"
@@ -7,7 +7,7 @@
.PP
hledger-ui is a terminal interface (TUI) for the hledger accounting
tool.
-This manual is for hledger-ui 1.22.1.
+This manual is for hledger-ui 1.22.2.
.SH SYNOPSIS
.PP
\f[C]hledger-ui [OPTIONS] [QUERYARGS]\f[R]
diff --git a/hledger-ui.cabal b/hledger-ui.cabal
index 3faa082..ea00213 100644
--- a/hledger-ui.cabal
+++ b/hledger-ui.cabal
@@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack
name: hledger-ui
-version: 1.22.1
+version: 1.22.2
synopsis: Curses-style terminal interface for the hledger accounting system
description: A simple curses-style terminal user interface for the hledger accounting system.
It can be a more convenient way to browse your accounts than the CLI.
@@ -63,7 +63,7 @@ executable hledger-ui
hs-source-dirs:
./
ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans
- cpp-options: -DVERSION="1.22.1"
+ cpp-options: -DVERSION="1.22.2"
build-depends:
ansi-terminal >=0.9
, async
@@ -77,8 +77,8 @@ executable hledger-ui
, extra >=1.6.3
, filepath
, fsnotify >=0.2.1.2 && <0.4
- , hledger >=1.22.1 && <1.23
- , hledger-lib >=1.22.1 && <1.23
+ , hledger >=1.22.2 && <1.23
+ , hledger-lib >=1.22.2 && <1.23
, megaparsec >=7.0.0 && <9.2
, microlens >=0.4
, microlens-platform >=0.2.3.1
diff --git a/hledger-ui.info b/hledger-ui.info
index addc107..2ae9670 100644
--- a/hledger-ui.info
+++ b/hledger-ui.info
@@ -12,7 +12,7 @@ hledger-ui(1)
*************
hledger-ui is a terminal interface (TUI) for the hledger accounting
-tool. This manual is for hledger-ui 1.22.1.
+tool. This manual is for hledger-ui 1.22.2.
'hledger-ui [OPTIONS] [QUERYARGS]'
'hledger ui -- [OPTIONS] [QUERYARGS]'
diff --git a/hledger-ui.txt b/hledger-ui.txt
index cce76d0..23cba34 100644
--- a/hledger-ui.txt
+++ b/hledger-ui.txt
@@ -5,7 +5,7 @@ HLEDGER-UI(1) hledger User Manuals HLEDGER-UI(1)
NAME
hledger-ui is a terminal interface (TUI) for the hledger accounting
- tool. This manual is for hledger-ui 1.22.1.
+ tool. This manual is for hledger-ui 1.22.2.
SYNOPSIS
hledger-ui [OPTIONS] [QUERYARGS]
@@ -504,4 +504,4 @@ SEE ALSO
-hledger-ui-1.22.1 August 2021 HLEDGER-UI(1)
+hledger-ui-1.22.2 August 2021 HLEDGER-UI(1)