From 2edb1f2705bfa98fe48d2522a080bfb17e3a8959 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 17 Oct 2018 05:37:07 -0700 Subject: [PATCH] ui: always enable periodic transactions and transaction modifiers Rule-based transactions and postings are always generated (--forecast and --auto are always on). Experimental. --- hledger-ui/Hledger/UI/AccountsScreen.hs | 1 + hledger-ui/Hledger/UI/Main.hs | 18 ++++++++++-------- hledger-ui/hledger-ui.m4.md | 6 +++++- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/hledger-ui/Hledger/UI/AccountsScreen.hs b/hledger-ui/Hledger/UI/AccountsScreen.hs index 1cc9e7343..51bb428dc 100644 --- a/hledger-ui/Hledger/UI/AccountsScreen.hs +++ b/hledger-ui/Hledger/UI/AccountsScreen.hs @@ -90,6 +90,7 @@ asInit d reset ui@UIState{ -- run the report (items,_total) = report ropts' q j where + -- XXX in historical mode, --forecast throws off the starting balances report | balancetype_ ropts == HistoricalBalance = balanceReportFromMultiBalanceReport | otherwise = balanceReport -- still using the old balanceReport for change reports as it diff --git a/hledger-ui/Hledger/UI/Main.hs b/hledger-ui/Hledger/UI/Main.hs index 63d354284..f7128feb4 100644 --- a/hledger-ui/Hledger/UI/Main.hs +++ b/hledger-ui/Hledger/UI/Main.hs @@ -71,19 +71,21 @@ main = do | otherwise = withJournalDoUICommand opts runBrickUi -- TODO fix nasty duplication of withJournalDo +-- | hledger-ui's version of withJournalDo. Enables --auto and --forecast. withJournalDoUICommand :: UIOpts -> (UIOpts -> Journal -> IO ()) -> IO () -withJournalDoUICommand uopts@UIOpts{cliopts_=copts} cmd = do - journalpath <- journalFilePathFromOpts copts - ej <- readJournalFiles (inputopts_ copts) journalpath +withJournalDoUICommand uopts@UIOpts{cliopts_=copts@CliOpts{inputopts_=iopts,reportopts_=ropts}} cmd = do + let copts' = copts{inputopts_=iopts{auto_=True}, reportopts_=ropts{forecast_=True}} + journalpath <- journalFilePathFromOpts copts' + ej <- readJournalFiles (inputopts_ copts') journalpath let fn = cmd uopts - . pivotByOpts copts - . anonymiseByOpts copts - <=< journalApplyValue (reportopts_ copts) - <=< journalAddForecast copts + . pivotByOpts copts' + . anonymiseByOpts copts' + <=< journalApplyValue (reportopts_ copts') + <=< journalAddForecast copts' either error' fn ej runBrickUi :: UIOpts -> Journal -> IO () -runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do +runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{inputopts_=_iopts,reportopts_=ropts}} j = do d <- getCurrentDay let diff --git a/hledger-ui/hledger-ui.m4.md b/hledger-ui/hledger-ui.m4.md index dd93871d3..23cd2678a 100644 --- a/hledger-ui/hledger-ui.m4.md +++ b/hledger-ui/hledger-ui.m4.md @@ -44,7 +44,11 @@ hledger-ui is hledger's curses-style interface, providing an efficient full-wind for viewing accounts and transactions, and some limited data entry capability. It is easier than hledger's command-line interface, and sometimes quicker and more convenient than the web interface. -Note hledger-ui hides transactions dated in the future, by default. + +Note hledger-ui has some different defaults: +- it generates rule-based transactions and postings by default (--forecast and --auto are always on). +- it hides transactions dated in the future by default (change this with --future or the F key). +Experimental. Like hledger, it reads _files_ For more about this see hledger(1), hledger_journal(5) etc.