equity: rename to close
This commit is contained in:
		
							parent
							
								
									98dcd1406e
								
							
						
					
					
						commit
						1234671c69
					
				| @ -286,7 +286,7 @@ standardAddonsHelp = [ | ||||
|   ,("web", "start the web interface") | ||||
|   ,("accounts", "list account names") | ||||
|   ,("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") | ||||
|   ,("register-csv", "output a register report as CSV") | ||||
|   ,("rewrite", "add specified postings to matched transaction entries") | ||||
|  | ||||
| @ -20,7 +20,7 @@ module Hledger.Cli.Commands ( | ||||
|   ,module Hledger.Cli.Commands.Cashflow | ||||
|   ,module Hledger.Cli.Commands.Checkdates | ||||
|   ,module Hledger.Cli.Commands.Checkdupes | ||||
|   ,module Hledger.Cli.Commands.Equity | ||||
|   ,module Hledger.Cli.Commands.Close | ||||
|   ,module Hledger.Cli.Commands.Help | ||||
|   ,module Hledger.Cli.Commands.Import | ||||
|   ,module Hledger.Cli.Commands.Incomestatement | ||||
| @ -59,7 +59,7 @@ import Hledger.Cli.Commands.Balancesheetequity | ||||
| import Hledger.Cli.Commands.Cashflow | ||||
| import Hledger.Cli.Commands.Checkdates | ||||
| import Hledger.Cli.Commands.Checkdupes | ||||
| import Hledger.Cli.Commands.Equity | ||||
| import Hledger.Cli.Commands.Close | ||||
| import Hledger.Cli.Commands.Help | ||||
| import Hledger.Cli.Commands.Import | ||||
| import Hledger.Cli.Commands.Incomestatement | ||||
| @ -86,7 +86,7 @@ builtinCommands = [ | ||||
|   ,(cashflowmode           , cashflow) | ||||
|   ,(checkdatesmode         , checkdates) | ||||
|   ,(checkdupesmode         , checkdupes) | ||||
|   ,(equitymode             , equity) | ||||
|   ,(closemode              , close) | ||||
|   ,(helpmode               , help') | ||||
|   ,(importmode             , importcmd) | ||||
|   ,(incomestatementmode    , incomestatement) | ||||
| @ -152,7 +152,7 @@ UIs: | ||||
|  web                      start web ui | ||||
| 
 | ||||
| Generating data: | ||||
|  equity                   generate balance-resetting transactions | ||||
|  close                    generate balance-resetting transactions | ||||
|  interest                 generate interest transactions | ||||
|  rewrite                  generate automated postings on matched transactions | ||||
| 
 | ||||
|  | ||||
| @ -1,9 +1,9 @@ | ||||
| {-# LANGUAGE OverloadedStrings #-} | ||||
| {-# LANGUAGE QuasiQuotes #-} | ||||
| 
 | ||||
| module Hledger.Cli.Commands.Equity ( | ||||
|   equitymode | ||||
|  ,equity | ||||
| module Hledger.Cli.Commands.Close ( | ||||
|   closemode | ||||
|  ,close | ||||
| )  | ||||
| where | ||||
| 
 | ||||
| @ -13,8 +13,8 @@ import Data.Time.Calendar | ||||
| import Hledger | ||||
| import Hledger.Cli.CliOptions | ||||
| 
 | ||||
| equitymode = hledgerCommandMode | ||||
|   [here| equity | ||||
| closemode = hledgerCommandMode | ||||
|   [here| close equity | ||||
| Print a "closing balances" transaction that brings all accounts (or with | ||||
| query arguments, just the matched accounts) to a zero (historical) balance,  | ||||
| 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: | ||||
| ``` | ||||
| $ 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 | ||||
| # now: | ||||
| $ 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  | ||||
| ``` | ||||
| 
 | ||||
| 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 | ||||
|     expenses:food          1 | ||||
| @ -62,7 +63,7 @@ Transactions spanning a file boundary may complicate matters. Eg: | ||||
|   [] | ||||
|   ([], Just $ argsFlag "[QUERY]") | ||||
| 
 | ||||
| equity CliOpts{reportopts_=ropts} j = do | ||||
| close CliOpts{reportopts_=ropts} j = do | ||||
|   today <- getCurrentDay | ||||
|   let  | ||||
|       ropts_ = ropts{balancetype_=HistoricalBalance, accountlistmode_=ALFlat} | ||||
| @ -2137,11 +2137,15 @@ With a query, only matched transactions' dates are checked. | ||||
| .PP | ||||
| Report account names having the same leaf but different prefixes. | ||||
| An example: http://stefanorodighiero.net/software/hledger\-dupes.html | ||||
| .SS equity | ||||
| .SS close | ||||
| .PP | ||||
| 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 \[lq]equity\[rq], as in Ledger, and that alias | ||||
| is also accepted. | ||||
| See close \[en]help for more. | ||||
| .SS help | ||||
| .PP | ||||
| Show any of the hledger manuals. | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| -- | ||||
| -- see: https://github.com/sol/hpack | ||||
| -- | ||||
| -- hash: 8e14dbb3cafd99102e0a85bd39076ca0af4c9554f348cd6cacb0d59faf63623b | ||||
| -- hash: 4b322928cce5df23c77a7f404c11167cd43fc20c0e236fa93a61ed474c003d64 | ||||
| 
 | ||||
| name:           hledger | ||||
| version:        1.5 | ||||
| @ -136,7 +136,7 @@ library | ||||
|       Hledger.Cli.Commands.Cashflow | ||||
|       Hledger.Cli.Commands.Checkdates | ||||
|       Hledger.Cli.Commands.Checkdupes | ||||
|       Hledger.Cli.Commands.Equity | ||||
|       Hledger.Cli.Commands.Close | ||||
|       Hledger.Cli.Commands.Help | ||||
|       Hledger.Cli.Commands.Import | ||||
|       Hledger.Cli.Commands.Incomestatement | ||||
|  | ||||
| @ -865,7 +865,7 @@ detailed command help. | ||||
| * cashflow:: | ||||
| * check-dates:: | ||||
| * check-dupes:: | ||||
| * equity:: | ||||
| * close:: | ||||
| * help:: | ||||
| * import:: | ||||
| * incomestatement:: | ||||
| @ -1680,7 +1680,7 @@ Check that transactions are sorted by increasing date.  With a query, | ||||
| 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 | ||||
| =============== | ||||
| @ -1689,17 +1689,19 @@ Report account names having the same leaf but different prefixes.  An | ||||
| 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 | ||||
| balances to zero and back.  Can be useful for bringing account balances | ||||
| across file boundaries. | ||||
| balances to zero and back.  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. | ||||
| 
 | ||||
|  | ||||
| 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 | ||||
| ========= | ||||
| @ -2408,97 +2410,97 @@ Node: QUERIES24324 | ||||
| Ref: #queries24426 | ||||
| Node: COMMANDS28393 | ||||
| Ref: #commands28505 | ||||
| Node: accounts29488 | ||||
| Ref: #accounts29586 | ||||
| Node: activity30579 | ||||
| Ref: #activity30689 | ||||
| Node: add31049 | ||||
| Ref: #add31148 | ||||
| Node: balance33809 | ||||
| Ref: #balance33920 | ||||
| Node: Flat mode37294 | ||||
| Ref: #flat-mode37419 | ||||
| Node: Depth limited balance reports37839 | ||||
| Ref: #depth-limited-balance-reports38040 | ||||
| Node: Multicolumn balance reports38460 | ||||
| Ref: #multicolumn-balance-reports38655 | ||||
| Node: Budgets43344 | ||||
| Ref: #budgets43491 | ||||
| Node: Custom balance output47322 | ||||
| Ref: #custom-balance-output47484 | ||||
| Node: Colour support49577 | ||||
| Ref: #colour-support49736 | ||||
| Node: Output destination49909 | ||||
| Ref: #output-destination50065 | ||||
| Node: CSV output50335 | ||||
| Ref: #csv-output50452 | ||||
| Node: balancesheet50849 | ||||
| Ref: #balancesheet50985 | ||||
| Node: balancesheetequity52953 | ||||
| Ref: #balancesheetequity53102 | ||||
| Node: cashflow53891 | ||||
| Ref: #cashflow54019 | ||||
| Node: check-dates55931 | ||||
| Ref: #check-dates56058 | ||||
| Node: check-dupes56175 | ||||
| Ref: #check-dupes56300 | ||||
| Node: equity56437 | ||||
| Ref: #equity56547 | ||||
| Node: help56710 | ||||
| Ref: #help56811 | ||||
| Node: import57885 | ||||
| Ref: #import57999 | ||||
| Node: incomestatement58729 | ||||
| Ref: #incomestatement58863 | ||||
| Node: prices60816 | ||||
| Ref: #prices60931 | ||||
| Node: print60974 | ||||
| Ref: #print61084 | ||||
| Node: print-unique65969 | ||||
| Ref: #print-unique66095 | ||||
| Node: register66163 | ||||
| Ref: #register66290 | ||||
| Node: Custom register output70791 | ||||
| Ref: #custom-register-output70920 | ||||
| Node: register-match72217 | ||||
| Ref: #register-match72351 | ||||
| Node: rewrite72534 | ||||
| Ref: #rewrite72651 | ||||
| Node: stats72720 | ||||
| Ref: #stats72823 | ||||
| Node: tags73705 | ||||
| Ref: #tags73803 | ||||
| Node: test74039 | ||||
| Ref: #test74123 | ||||
| Node: ADD-ON COMMANDS74491 | ||||
| Ref: #add-on-commands74601 | ||||
| Node: Official add-ons75888 | ||||
| Ref: #official-add-ons76028 | ||||
| Node: api76115 | ||||
| Ref: #api76204 | ||||
| Node: ui76256 | ||||
| Ref: #ui76355 | ||||
| Node: web76413 | ||||
| Ref: #web76502 | ||||
| Node: Third party add-ons76548 | ||||
| Ref: #third-party-add-ons76723 | ||||
| Node: diff76858 | ||||
| Ref: #diff76955 | ||||
| Node: iadd77054 | ||||
| Ref: #iadd77168 | ||||
| Node: interest77251 | ||||
| Ref: #interest77372 | ||||
| Node: irr77467 | ||||
| Ref: #irr77565 | ||||
| Node: Experimental add-ons77643 | ||||
| Ref: #experimental-add-ons77795 | ||||
| Node: autosync78086 | ||||
| Ref: #autosync78198 | ||||
| Node: budget78437 | ||||
| Ref: #budget78559 | ||||
| Node: chart78625 | ||||
| Ref: #chart78742 | ||||
| Node: check78813 | ||||
| Ref: #check78915 | ||||
| Node: accounts29487 | ||||
| Ref: #accounts29585 | ||||
| Node: activity30578 | ||||
| Ref: #activity30688 | ||||
| Node: add31048 | ||||
| Ref: #add31147 | ||||
| Node: balance33808 | ||||
| Ref: #balance33919 | ||||
| Node: Flat mode37293 | ||||
| Ref: #flat-mode37418 | ||||
| Node: Depth limited balance reports37838 | ||||
| Ref: #depth-limited-balance-reports38039 | ||||
| Node: Multicolumn balance reports38459 | ||||
| Ref: #multicolumn-balance-reports38654 | ||||
| Node: Budgets43343 | ||||
| Ref: #budgets43490 | ||||
| Node: Custom balance output47321 | ||||
| Ref: #custom-balance-output47483 | ||||
| Node: Colour support49576 | ||||
| Ref: #colour-support49735 | ||||
| Node: Output destination49908 | ||||
| Ref: #output-destination50064 | ||||
| Node: CSV output50334 | ||||
| Ref: #csv-output50451 | ||||
| Node: balancesheet50848 | ||||
| Ref: #balancesheet50984 | ||||
| Node: balancesheetequity52952 | ||||
| Ref: #balancesheetequity53101 | ||||
| Node: cashflow53890 | ||||
| Ref: #cashflow54018 | ||||
| Node: check-dates55930 | ||||
| Ref: #check-dates56057 | ||||
| Node: check-dupes56174 | ||||
| Ref: #check-dupes56298 | ||||
| Node: close56435 | ||||
| Ref: #close56542 | ||||
| Node: help56872 | ||||
| Ref: #help56972 | ||||
| Node: import58046 | ||||
| Ref: #import58160 | ||||
| Node: incomestatement58890 | ||||
| Ref: #incomestatement59024 | ||||
| Node: prices60977 | ||||
| Ref: #prices61092 | ||||
| Node: print61135 | ||||
| Ref: #print61245 | ||||
| Node: print-unique66130 | ||||
| Ref: #print-unique66256 | ||||
| Node: register66324 | ||||
| Ref: #register66451 | ||||
| Node: Custom register output70952 | ||||
| Ref: #custom-register-output71081 | ||||
| Node: register-match72378 | ||||
| Ref: #register-match72512 | ||||
| Node: rewrite72695 | ||||
| Ref: #rewrite72812 | ||||
| Node: stats72881 | ||||
| Ref: #stats72984 | ||||
| Node: tags73866 | ||||
| Ref: #tags73964 | ||||
| Node: test74200 | ||||
| Ref: #test74284 | ||||
| Node: ADD-ON COMMANDS74652 | ||||
| Ref: #add-on-commands74762 | ||||
| Node: Official add-ons76049 | ||||
| Ref: #official-add-ons76189 | ||||
| Node: api76276 | ||||
| Ref: #api76365 | ||||
| Node: ui76417 | ||||
| Ref: #ui76516 | ||||
| Node: web76574 | ||||
| Ref: #web76663 | ||||
| Node: Third party add-ons76709 | ||||
| Ref: #third-party-add-ons76884 | ||||
| Node: diff77019 | ||||
| Ref: #diff77116 | ||||
| Node: iadd77215 | ||||
| Ref: #iadd77329 | ||||
| Node: interest77412 | ||||
| Ref: #interest77533 | ||||
| Node: irr77628 | ||||
| Ref: #irr77726 | ||||
| Node: Experimental add-ons77804 | ||||
| Ref: #experimental-add-ons77956 | ||||
| Node: autosync78247 | ||||
| Ref: #autosync78359 | ||||
| Node: budget78598 | ||||
| Ref: #budget78720 | ||||
| Node: chart78786 | ||||
| Ref: #chart78903 | ||||
| Node: check78974 | ||||
| Ref: #check79076 | ||||
|  | ||||
| End Tag Table | ||||
|  | ||||
| @ -1520,10 +1520,12 @@ COMMANDS | ||||
|        Report  account  names having the same leaf but different prefixes.  An | ||||
|        example: http://stefanorodighiero.net/software/hledger-dupes.html | ||||
| 
 | ||||
|    equity | ||||
|    close | ||||
|        Print closing/opening transactions that bring some or all account  bal- | ||||
|        ances  to  zero  and back.  Can be useful for bringing account balances | ||||
|        across file boundaries. | ||||
|        ances  to  zero  and  back.  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 | ||||
|        Show any of the hledger manuals. | ||||
|  | ||||
| @ -355,9 +355,12 @@ With a query, only matched transactions' dates are checked. | ||||
| Report account names having the same leaf but different prefixes.  | ||||
| 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.  | ||||
| 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 | ||||
| Show any of the hledger manuals. | ||||
|  | ||||
| @ -113,7 +113,7 @@ library: | ||||
|   - Hledger.Cli.Commands.Cashflow | ||||
|   - Hledger.Cli.Commands.Checkdates | ||||
|   - Hledger.Cli.Commands.Checkdupes | ||||
|   - Hledger.Cli.Commands.Equity | ||||
|   - Hledger.Cli.Commands.Close | ||||
|   - Hledger.Cli.Commands.Help | ||||
|   - Hledger.Cli.Commands.Import | ||||
|   - Hledger.Cli.Commands.Incomestatement | ||||
|  | ||||
| @ -1,7 +1,6 @@ | ||||
| # Tests for equity addon | ||||
| 
 | ||||
| # Simple case | ||||
| hledger equity -f- -p 2016 assets liabilities | ||||
| hledger close -f- -p 2016 assets liabilities | ||||
| <<< | ||||
| 2016/1/1 open | ||||
|     assets:bank         $100 | ||||
| @ -35,7 +34,7 @@ hledger equity -f- -p 2016 assets liabilities | ||||
| >>>=0 | ||||
| 
 | ||||
| # Test aggregation of postings with prices | ||||
| hledger equity -f- -p 2016 assets liabilities | ||||
| hledger close -f- -p 2016 assets liabilities | ||||
| <<< | ||||
| Y2016 | ||||
| 01/31 | ||||
| @ -71,7 +70,7 @@ Y2016 | ||||
| >>>=0 | ||||
| 
 | ||||
| # A begin date should be ignored | ||||
| hledger equity -f- -b2017/6/1 -e2018 | ||||
| hledger close -f- -b2017/6/1 -e2018 | ||||
| <<< | ||||
| 2017/1/1 | ||||
|     (a)   1 | ||||
| @ -85,35 +84,3 @@ hledger equity -f- -b2017/6/1 -e2018 | ||||
|     equity:opening balances | ||||
| 
 | ||||
| >>>=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 | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user