refactor BalanceView
This commit is contained in:
parent
9b9a1a7a30
commit
422e0923f1
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user