equity: rename to close

This commit is contained in:
Simon Michael 2018-01-03 17:02:35 -08:00
parent 98dcd1406e
commit 1234671c69
10 changed files with 138 additions and 159 deletions

View File

@ -286,7 +286,7 @@ standardAddonsHelp = [
,("web", "start the web interface") ,("web", "start the web interface")
,("accounts", "list account names") ,("accounts", "list account names")
,("balance-csv", "output a balance report as CSV") ,("balance-csv", "output a balance report as CSV")
,("equity", "show a transaction entry zeroing all accounts") ,("close", "show a transaction entry zeroing all accounts")
,("print-unique", "print only transactions with unique descriptions") ,("print-unique", "print only transactions with unique descriptions")
,("register-csv", "output a register report as CSV") ,("register-csv", "output a register report as CSV")
,("rewrite", "add specified postings to matched transaction entries") ,("rewrite", "add specified postings to matched transaction entries")

View File

@ -20,7 +20,7 @@ module Hledger.Cli.Commands (
,module Hledger.Cli.Commands.Cashflow ,module Hledger.Cli.Commands.Cashflow
,module Hledger.Cli.Commands.Checkdates ,module Hledger.Cli.Commands.Checkdates
,module Hledger.Cli.Commands.Checkdupes ,module Hledger.Cli.Commands.Checkdupes
,module Hledger.Cli.Commands.Equity ,module Hledger.Cli.Commands.Close
,module Hledger.Cli.Commands.Help ,module Hledger.Cli.Commands.Help
,module Hledger.Cli.Commands.Import ,module Hledger.Cli.Commands.Import
,module Hledger.Cli.Commands.Incomestatement ,module Hledger.Cli.Commands.Incomestatement
@ -59,7 +59,7 @@ import Hledger.Cli.Commands.Balancesheetequity
import Hledger.Cli.Commands.Cashflow import Hledger.Cli.Commands.Cashflow
import Hledger.Cli.Commands.Checkdates import Hledger.Cli.Commands.Checkdates
import Hledger.Cli.Commands.Checkdupes import Hledger.Cli.Commands.Checkdupes
import Hledger.Cli.Commands.Equity import Hledger.Cli.Commands.Close
import Hledger.Cli.Commands.Help import Hledger.Cli.Commands.Help
import Hledger.Cli.Commands.Import import Hledger.Cli.Commands.Import
import Hledger.Cli.Commands.Incomestatement import Hledger.Cli.Commands.Incomestatement
@ -86,7 +86,7 @@ builtinCommands = [
,(cashflowmode , cashflow) ,(cashflowmode , cashflow)
,(checkdatesmode , checkdates) ,(checkdatesmode , checkdates)
,(checkdupesmode , checkdupes) ,(checkdupesmode , checkdupes)
,(equitymode , equity) ,(closemode , close)
,(helpmode , help') ,(helpmode , help')
,(importmode , importcmd) ,(importmode , importcmd)
,(incomestatementmode , incomestatement) ,(incomestatementmode , incomestatement)
@ -152,7 +152,7 @@ UIs:
web start web ui web start web ui
Generating data: Generating data:
equity generate balance-resetting transactions close generate balance-resetting transactions
interest generate interest transactions interest generate interest transactions
rewrite generate automated postings on matched transactions rewrite generate automated postings on matched transactions

View File

@ -1,9 +1,9 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE QuasiQuotes #-}
module Hledger.Cli.Commands.Equity ( module Hledger.Cli.Commands.Close (
equitymode closemode
,equity ,close
) )
where where
@ -13,8 +13,8 @@ import Data.Time.Calendar
import Hledger import Hledger
import Hledger.Cli.CliOptions import Hledger.Cli.CliOptions
equitymode = hledgerCommandMode closemode = hledgerCommandMode
[here| equity [here| close equity
Print a "closing balances" transaction that brings all accounts (or with Print a "closing balances" transaction that brings all accounts (or with
query arguments, just the matched accounts) to a zero (historical) balance, query arguments, just the matched accounts) to a zero (historical) balance,
followed by an opposite "opening balances" transaction that restores the followed by an opposite "opening balances" transaction that restores the
@ -42,7 +42,7 @@ To close on some other date, use: `hledger close -e OPENINGDATE ...`.
For example, carrying asset/liability balances into a new file for 2018: For example, carrying asset/liability balances into a new file for 2018:
``` ```
$ hledger equity -f 2017.journal -e 2018/1/1 ^assets ^liab >>2017.journal $ hledger close -f 2017.journal -e 2018/1/1 ^assets ^liab >>2017.journal
# cut & paste the opening transaction from 2017.journal to a new 2018.journal # cut & paste the opening transaction from 2017.journal to a new 2018.journal
# now: # now:
$ hledger bs -f 2018.journal # correct balances $ hledger bs -f 2018.journal # correct balances
@ -50,7 +50,8 @@ $ hledger bs -f 2018.journal -f 2017.journal # still correct
$ hledger bs -f 2017.journal not:desc:closing # must exclude closing txn $ hledger bs -f 2017.journal not:desc:closing # must exclude closing txn
``` ```
Transactions spanning a file boundary may complicate matters. Eg: Transactions spanning the closing date may complicate matters. Eg, if
closing at end of 2017:
``` ```
2017/12/31 2017/12/31
expenses:food 1 expenses:food 1
@ -62,7 +63,7 @@ Transactions spanning a file boundary may complicate matters. Eg:
[] []
([], Just $ argsFlag "[QUERY]") ([], Just $ argsFlag "[QUERY]")
equity CliOpts{reportopts_=ropts} j = do close CliOpts{reportopts_=ropts} j = do
today <- getCurrentDay today <- getCurrentDay
let let
ropts_ = ropts{balancetype_=HistoricalBalance, accountlistmode_=ALFlat} ropts_ = ropts{balancetype_=HistoricalBalance, accountlistmode_=ALFlat}

View File

@ -2137,11 +2137,15 @@ With a query, only matched transactions' dates are checked.
.PP .PP
Report account names having the same leaf but different prefixes. Report account names having the same leaf but different prefixes.
An example: http://stefanorodighiero.net/software/hledger\-dupes.html An example: http://stefanorodighiero.net/software/hledger\-dupes.html
.SS equity .SS close
.PP .PP
Print closing/opening transactions that bring some or all account Print closing/opening transactions that bring some or all account
balances to zero and back. balances to zero and back.
Can be useful for bringing account balances across file boundaries. Can be useful for bringing asset/liability balances across file
boundaries, or for closing out income/expenses for a period.
This was formerly called \[lq]equity\[rq], as in Ledger, and that alias
is also accepted.
See close \[en]help for more.
.SS help .SS help
.PP .PP
Show any of the hledger manuals. Show any of the hledger manuals.

View File

@ -2,7 +2,7 @@
-- --
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
-- --
-- hash: 8e14dbb3cafd99102e0a85bd39076ca0af4c9554f348cd6cacb0d59faf63623b -- hash: 4b322928cce5df23c77a7f404c11167cd43fc20c0e236fa93a61ed474c003d64
name: hledger name: hledger
version: 1.5 version: 1.5
@ -136,7 +136,7 @@ library
Hledger.Cli.Commands.Cashflow Hledger.Cli.Commands.Cashflow
Hledger.Cli.Commands.Checkdates Hledger.Cli.Commands.Checkdates
Hledger.Cli.Commands.Checkdupes Hledger.Cli.Commands.Checkdupes
Hledger.Cli.Commands.Equity Hledger.Cli.Commands.Close
Hledger.Cli.Commands.Help Hledger.Cli.Commands.Help
Hledger.Cli.Commands.Import Hledger.Cli.Commands.Import
Hledger.Cli.Commands.Incomestatement Hledger.Cli.Commands.Incomestatement

View File

@ -865,7 +865,7 @@ detailed command help.
* cashflow:: * cashflow::
* check-dates:: * check-dates::
* check-dupes:: * check-dupes::
* equity:: * close::
* help:: * help::
* import:: * import::
* incomestatement:: * incomestatement::
@ -1680,7 +1680,7 @@ Check that transactions are sorted by increasing date. With a query,
only matched transactions' dates are checked. only matched transactions' dates are checked.
 
File: hledger.info, Node: check-dupes, Next: equity, Prev: check-dates, Up: COMMANDS File: hledger.info, Node: check-dupes, Next: close, Prev: check-dates, Up: COMMANDS
4.9 check-dupes 4.9 check-dupes
=============== ===============
@ -1689,17 +1689,19 @@ Report account names having the same leaf but different prefixes. An
example: http://stefanorodighiero.net/software/hledger-dupes.html example: http://stefanorodighiero.net/software/hledger-dupes.html
 
File: hledger.info, Node: equity, Next: help, Prev: check-dupes, Up: COMMANDS File: hledger.info, Node: close, Next: help, Prev: check-dupes, Up: COMMANDS
4.10 equity 4.10 close
=========== ==========
Print closing/opening transactions that bring some or all account Print closing/opening transactions that bring some or all account
balances to zero and back. Can be useful for bringing account balances balances to zero and back. Can be useful for bringing asset/liability
across file boundaries. balances across file boundaries, or for closing out income/expenses for
a period. This was formerly called "equity", as in Ledger, and that
alias is also accepted. See close -help for more.
 
File: hledger.info, Node: help, Next: import, Prev: equity, Up: COMMANDS File: hledger.info, Node: help, Next: import, Prev: close, Up: COMMANDS
4.11 help 4.11 help
========= =========
@ -2408,97 +2410,97 @@ Node: QUERIES24324
Ref: #queries24426 Ref: #queries24426
Node: COMMANDS28393 Node: COMMANDS28393
Ref: #commands28505 Ref: #commands28505
Node: accounts29488 Node: accounts29487
Ref: #accounts29586 Ref: #accounts29585
Node: activity30579 Node: activity30578
Ref: #activity30689 Ref: #activity30688
Node: add31049 Node: add31048
Ref: #add31148 Ref: #add31147
Node: balance33809 Node: balance33808
Ref: #balance33920 Ref: #balance33919
Node: Flat mode37294 Node: Flat mode37293
Ref: #flat-mode37419 Ref: #flat-mode37418
Node: Depth limited balance reports37839 Node: Depth limited balance reports37838
Ref: #depth-limited-balance-reports38040 Ref: #depth-limited-balance-reports38039
Node: Multicolumn balance reports38460 Node: Multicolumn balance reports38459
Ref: #multicolumn-balance-reports38655 Ref: #multicolumn-balance-reports38654
Node: Budgets43344 Node: Budgets43343
Ref: #budgets43491 Ref: #budgets43490
Node: Custom balance output47322 Node: Custom balance output47321
Ref: #custom-balance-output47484 Ref: #custom-balance-output47483
Node: Colour support49577 Node: Colour support49576
Ref: #colour-support49736 Ref: #colour-support49735
Node: Output destination49909 Node: Output destination49908
Ref: #output-destination50065 Ref: #output-destination50064
Node: CSV output50335 Node: CSV output50334
Ref: #csv-output50452 Ref: #csv-output50451
Node: balancesheet50849 Node: balancesheet50848
Ref: #balancesheet50985 Ref: #balancesheet50984
Node: balancesheetequity52953 Node: balancesheetequity52952
Ref: #balancesheetequity53102 Ref: #balancesheetequity53101
Node: cashflow53891 Node: cashflow53890
Ref: #cashflow54019 Ref: #cashflow54018
Node: check-dates55931 Node: check-dates55930
Ref: #check-dates56058 Ref: #check-dates56057
Node: check-dupes56175 Node: check-dupes56174
Ref: #check-dupes56300 Ref: #check-dupes56298
Node: equity56437 Node: close56435
Ref: #equity56547 Ref: #close56542
Node: help56710 Node: help56872
Ref: #help56811 Ref: #help56972
Node: import57885 Node: import58046
Ref: #import57999 Ref: #import58160
Node: incomestatement58729 Node: incomestatement58890
Ref: #incomestatement58863 Ref: #incomestatement59024
Node: prices60816 Node: prices60977
Ref: #prices60931 Ref: #prices61092
Node: print60974 Node: print61135
Ref: #print61084 Ref: #print61245
Node: print-unique65969 Node: print-unique66130
Ref: #print-unique66095 Ref: #print-unique66256
Node: register66163 Node: register66324
Ref: #register66290 Ref: #register66451
Node: Custom register output70791 Node: Custom register output70952
Ref: #custom-register-output70920 Ref: #custom-register-output71081
Node: register-match72217 Node: register-match72378
Ref: #register-match72351 Ref: #register-match72512
Node: rewrite72534 Node: rewrite72695
Ref: #rewrite72651 Ref: #rewrite72812
Node: stats72720 Node: stats72881
Ref: #stats72823 Ref: #stats72984
Node: tags73705 Node: tags73866
Ref: #tags73803 Ref: #tags73964
Node: test74039 Node: test74200
Ref: #test74123 Ref: #test74284
Node: ADD-ON COMMANDS74491 Node: ADD-ON COMMANDS74652
Ref: #add-on-commands74601 Ref: #add-on-commands74762
Node: Official add-ons75888 Node: Official add-ons76049
Ref: #official-add-ons76028 Ref: #official-add-ons76189
Node: api76115 Node: api76276
Ref: #api76204 Ref: #api76365
Node: ui76256 Node: ui76417
Ref: #ui76355 Ref: #ui76516
Node: web76413 Node: web76574
Ref: #web76502 Ref: #web76663
Node: Third party add-ons76548 Node: Third party add-ons76709
Ref: #third-party-add-ons76723 Ref: #third-party-add-ons76884
Node: diff76858 Node: diff77019
Ref: #diff76955 Ref: #diff77116
Node: iadd77054 Node: iadd77215
Ref: #iadd77168 Ref: #iadd77329
Node: interest77251 Node: interest77412
Ref: #interest77372 Ref: #interest77533
Node: irr77467 Node: irr77628
Ref: #irr77565 Ref: #irr77726
Node: Experimental add-ons77643 Node: Experimental add-ons77804
Ref: #experimental-add-ons77795 Ref: #experimental-add-ons77956
Node: autosync78086 Node: autosync78247
Ref: #autosync78198 Ref: #autosync78359
Node: budget78437 Node: budget78598
Ref: #budget78559 Ref: #budget78720
Node: chart78625 Node: chart78786
Ref: #chart78742 Ref: #chart78903
Node: check78813 Node: check78974
Ref: #check78915 Ref: #check79076
 
End Tag Table End Tag Table

View File

@ -1520,10 +1520,12 @@ COMMANDS
Report account names having the same leaf but different prefixes. An Report account names having the same leaf but different prefixes. An
example: http://stefanorodighiero.net/software/hledger-dupes.html example: http://stefanorodighiero.net/software/hledger-dupes.html
equity close
Print closing/opening transactions that bring some or all account bal- Print closing/opening transactions that bring some or all account bal-
ances to zero and back. Can be useful for bringing account balances ances to zero and back. Can be useful for bringing asset/liability
across file boundaries. balances across file boundaries, or for closing out income/expenses for
a period. This was formerly called "equity", as in Ledger, and that
alias is also accepted. See close -help for more.
help help
Show any of the hledger manuals. Show any of the hledger manuals.

View File

@ -355,9 +355,12 @@ With a query, only matched transactions' dates are checked.
Report account names having the same leaf but different prefixes. Report account names having the same leaf but different prefixes.
An example: http://stefanorodighiero.net/software/hledger-dupes.html An example: http://stefanorodighiero.net/software/hledger-dupes.html
## equity ## close
Print closing/opening transactions that bring some or all account balances to zero and back. Print closing/opening transactions that bring some or all account balances to zero and back.
Can be useful for bringing account balances across file boundaries. Can be useful for bringing asset/liability balances across file boundaries,
or for closing out income/expenses for a period.
This was formerly called "equity", as in Ledger, and that alias is also accepted.
See close --help for more.
## help ## help
Show any of the hledger manuals. Show any of the hledger manuals.

View File

@ -113,7 +113,7 @@ library:
- Hledger.Cli.Commands.Cashflow - Hledger.Cli.Commands.Cashflow
- Hledger.Cli.Commands.Checkdates - Hledger.Cli.Commands.Checkdates
- Hledger.Cli.Commands.Checkdupes - Hledger.Cli.Commands.Checkdupes
- Hledger.Cli.Commands.Equity - Hledger.Cli.Commands.Close
- Hledger.Cli.Commands.Help - Hledger.Cli.Commands.Help
- Hledger.Cli.Commands.Import - Hledger.Cli.Commands.Import
- Hledger.Cli.Commands.Incomestatement - Hledger.Cli.Commands.Incomestatement

View File

@ -1,7 +1,6 @@
# Tests for equity addon
# Simple case # Simple case
hledger equity -f- -p 2016 assets liabilities hledger close -f- -p 2016 assets liabilities
<<< <<<
2016/1/1 open 2016/1/1 open
assets:bank $100 assets:bank $100
@ -35,7 +34,7 @@ hledger equity -f- -p 2016 assets liabilities
>>>=0 >>>=0
# Test aggregation of postings with prices # Test aggregation of postings with prices
hledger equity -f- -p 2016 assets liabilities hledger close -f- -p 2016 assets liabilities
<<< <<<
Y2016 Y2016
01/31 01/31
@ -71,7 +70,7 @@ Y2016
>>>=0 >>>=0
# A begin date should be ignored # A begin date should be ignored
hledger equity -f- -b2017/6/1 -e2018 hledger close -f- -b2017/6/1 -e2018
<<< <<<
2017/1/1 2017/1/1
(a) 1 (a) 1
@ -85,35 +84,3 @@ hledger equity -f- -b2017/6/1 -e2018
equity:opening balances equity:opening balances
>>>=0 >>>=0
# # Tear transaction across periods
# # TODO: clarify what should we see for this case
# ../../bin/hledger-equity -f- -p 2016 assets liabilities
# <<<
# 2016/1/1 open
# assets:bank $100
# assets:cash $20
# equity:opening
#
# 2016/1/15 spend
# expenses:sweets $5
# assets:cash
#
# 2017/1/1 withdraw and lend
# liabilities $25
# assets:cash $-5
# assets:bank $-20 ; date:2016/12/31
# >>>
# 2016/12/31 closing balances
# assets:bank $-80
# assets:cash $-15
# equity:closing balances
#
# 2017/01/01 opening balances
# assets:bank $80
# assets:cash $15
# equity:opening balances
#
# >>>=0