From 422e0923f1afbe26fd280d0b951d2156ce85aadb Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 24 Jul 2017 22:56:55 +0100 Subject: [PATCH] refactor BalanceView --- hledger/Hledger/Cli/Balancesheet.hs | 9 +++++---- hledger/Hledger/Cli/Cashflow.hs | 9 +++++---- hledger/Hledger/Cli/Incomestatement.hs | 9 +++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/hledger/Hledger/Cli/Balancesheet.hs b/hledger/Hledger/Cli/Balancesheet.hs index 9149a96eb..21678b68b 100644 --- a/hledger/Hledger/Cli/Balancesheet.hs +++ b/hledger/Hledger/Cli/Balancesheet.hs @@ -19,10 +19,11 @@ import Hledger import Hledger.Cli.CliOptions import Hledger.Cli.BalanceView -bsBV = BalanceView { +balancesheetBV = BalanceView { bvmode = "balancesheet", bvaliases = ["bs"], - bvhelp = [here|This command displays a simple balance sheet, showing historical ending + bvhelp = [here| +This command displays a simple balance sheet, showing historical ending balances of asset and liability accounts (ignoring any report begin date). It assumes that these accounts are under a top-level `asset` or `liability` account (plural forms also allowed). @@ -35,10 +36,10 @@ account (plural forms also allowed). } balancesheetmode :: Mode RawOpts -balancesheetmode = balanceviewmode bsBV +balancesheetmode = balanceviewmode balancesheetBV balancesheet :: CliOpts -> Journal -> IO () -balancesheet = balanceviewReport bsBV +balancesheet = balanceviewReport balancesheetBV tests_Hledger_Cli_Balancesheet :: Test tests_Hledger_Cli_Balancesheet = TestList diff --git a/hledger/Hledger/Cli/Cashflow.hs b/hledger/Hledger/Cli/Cashflow.hs index 4abb6f2f4..968e4312d 100644 --- a/hledger/Hledger/Cli/Cashflow.hs +++ b/hledger/Hledger/Cli/Cashflow.hs @@ -22,10 +22,11 @@ import Hledger import Hledger.Cli.CliOptions import Hledger.Cli.BalanceView -cfBV = BalanceView { +cashflowBV = BalanceView { bvmode = "cashflow", bvaliases = ["cf"], - bvhelp = [here|This command displays a simple cashflow statement, showing changes + bvhelp = [here| +This command displays a simple cashflow statement, showing changes in "cash" accounts. It assumes that these accounts are under a top-level `asset` account and do not contain `receivable` or `A/R` in their name (plural forms also allowed). @@ -36,10 +37,10 @@ in "cash" accounts. It assumes that these accounts are under a top-level } cashflowmode :: Mode RawOpts -cashflowmode = balanceviewmode cfBV +cashflowmode = balanceviewmode cashflowBV cashflow :: CliOpts -> Journal -> IO () -cashflow = balanceviewReport cfBV +cashflow = balanceviewReport cashflowBV tests_Hledger_Cli_Cashflow :: Test tests_Hledger_Cli_Cashflow = TestList diff --git a/hledger/Hledger/Cli/Incomestatement.hs b/hledger/Hledger/Cli/Incomestatement.hs index 09fe470b8..a5848385f 100644 --- a/hledger/Hledger/Cli/Incomestatement.hs +++ b/hledger/Hledger/Cli/Incomestatement.hs @@ -19,10 +19,11 @@ import Hledger import Hledger.Cli.CliOptions import Hledger.Cli.BalanceView -isBV = BalanceView { +incomestatementBV = BalanceView { bvmode = "incomestatement", bvaliases = ["is"], - bvhelp = [here|This command displays a simple income statement, showing revenues + bvhelp = [here| +This command displays a simple income statement, showing revenues and expenses during a period. It assumes that these accounts are under a top-level `revenue` or `income` or `expense` account (plural forms also allowed). @@ -36,10 +37,10 @@ also allowed). } incomestatementmode :: Mode RawOpts -incomestatementmode = balanceviewmode isBV +incomestatementmode = balanceviewmode incomestatementBV incomestatement :: CliOpts -> Journal -> IO () -incomestatement = balanceviewReport isBV +incomestatement = balanceviewReport incomestatementBV tests_Hledger_Cli_Incomestatement :: Test tests_Hledger_Cli_Incomestatement = TestList