tools: update, rename cabal installation script
This commit is contained in:
parent
1056556b6f
commit
6476944330
@ -1,8 +0,0 @@
|
|||||||
cd hledger
|
|
||||||
cabal sandbox init
|
|
||||||
cabal sandbox add-source ../hledger-lib
|
|
||||||
cabal sandbox add-source ../hledger-web
|
|
||||||
|
|
||||||
cabal install --dependencies-only
|
|
||||||
cabal configure
|
|
||||||
cabal build
|
|
||||||
16
cabal-install.sh
Executable file
16
cabal-install.sh
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
# Run this script to install all hledger packages using cabal
|
||||||
|
# (if you prefer using cabal to stack)
|
||||||
|
|
||||||
|
# use a sandbox in this directory to avoid build problems
|
||||||
|
cabal sandbox init
|
||||||
|
|
||||||
|
# maybe useful for some developers..
|
||||||
|
cabal sandbox add-source ./hledger-lib
|
||||||
|
cabal sandbox add-source ./hledger
|
||||||
|
cabal sandbox add-source ./hledger-ui
|
||||||
|
cabal sandbox add-source ./hledger-web
|
||||||
|
cabal sandbox add-source ./hledger-api
|
||||||
|
|
||||||
|
# build and install
|
||||||
|
cabal install ./hledger-lib ./hledger ./hledger-ui ./hledger-web ./hledger-api \
|
||||||
|
&& echo "hledger executables successfully installed in ./.cabal-sandbox/bin"
|
||||||
@ -1,19 +1,51 @@
|
|||||||
#!/usr/bin/env runhaskell
|
#!/usr/bin/env stack
|
||||||
{-
|
{- stack runghc --verbosity info
|
||||||
|
--package hledger-lib
|
||||||
Like ledger's equity command, print a journal entry posting the total
|
--package hledger
|
||||||
balance of all accounts (or the specified account and its subaccounts)
|
--package time
|
||||||
in the default journal.
|
|
||||||
|
|
||||||
An entry like this is useful in the transition to a new journal file,
|
|
||||||
to zero out asset/liability balances in the old file and initialise
|
|
||||||
them in the new one. This way you get correct balances when reporting
|
|
||||||
on either file, and when including both files at once.
|
|
||||||
|
|
||||||
Usage: hledger-equity [ACCTPAT]
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
{-
|
||||||
|
hledger-equity [HLEDGEROPTS] [QUERY]
|
||||||
|
|
||||||
|
Show a "closing balances" transaction that brings the balance of the
|
||||||
|
accounts matched by QUERY (or all accounts) to zero, and an opposite
|
||||||
|
"opening balances" transaction that restores the balances from zero.
|
||||||
|
|
||||||
|
The opening balances transaction is useful to carry over
|
||||||
|
asset/liability balances if you choose to start a new journal file,
|
||||||
|
eg at the beginning of the year.
|
||||||
|
|
||||||
|
The closing balances transaction is useful to zero out balances in
|
||||||
|
the old file, which gives you the option of reporting on both files
|
||||||
|
at once while still seeing correct balances.
|
||||||
|
|
||||||
|
Balances are calculated, and the opening transaction is dated, as of
|
||||||
|
the report end date, which you should specify with -e or date: (and
|
||||||
|
the closing transaction is dated one day earlier). If a report end
|
||||||
|
date is not specified, it defaults to today.
|
||||||
|
|
||||||
|
If any matched account directly contains multiple commodities, the
|
||||||
|
output may not be valid journal syntax, and will need some editing.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
$ hledger equity -f 2015.journal -e 2016/1/1 assets liabilities >>2015.journal
|
||||||
|
move opening balances txn to 2016.journal
|
||||||
|
|
||||||
|
Open question: how to handle txns spanning a file boundary ? Eg:
|
||||||
|
2015/12/30 * food
|
||||||
|
expenses:food:dining $10
|
||||||
|
assets:bank:checking -$10 ; date:2016/1/4
|
||||||
|
|
||||||
|
This might or might not have some connection to the concept of
|
||||||
|
"closing the books" in accounting.
|
||||||
|
|
||||||
|
-}
|
||||||
|
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
|
import Data.Time.Calendar (addDays)
|
||||||
import Hledger.Cli
|
import Hledger.Cli
|
||||||
|
|
||||||
argsmode :: Mode RawOpts
|
argsmode :: Mode RawOpts
|
||||||
@ -22,6 +54,7 @@ argsmode = (defCommandMode ["equity"])
|
|||||||
++ " (or the specified account and its subaccounts)"
|
++ " (or the specified account and its subaccounts)"
|
||||||
, modeGroupFlags = Group
|
, modeGroupFlags = Group
|
||||||
{ groupNamed =
|
{ groupNamed =
|
||||||
|
-- XXX update to match hledger
|
||||||
[ ("Input",inputflags)
|
[ ("Input",inputflags)
|
||||||
, ("Reporting",reportflags)
|
, ("Reporting",reportflags)
|
||||||
, ("Misc",helpflags)
|
, ("Misc",helpflags)
|
||||||
@ -46,5 +79,5 @@ main = do
|
|||||||
enddate = fromMaybe today $ queryEndDate (date2_ ropts_) q
|
enddate = fromMaybe today $ queryEndDate (date2_ ropts_) q
|
||||||
nps = [posting{paccount=a, pamount=negate b} | ((a,_,_),b) <- acctbals]
|
nps = [posting{paccount=a, pamount=negate b} | ((a,_,_),b) <- acctbals]
|
||||||
++ [posting{paccount="equity:closing balances", pamount=negate balancingamt}]
|
++ [posting{paccount="equity:closing balances", pamount=negate balancingamt}]
|
||||||
putStr $ showTransactionUnelided (nulltransaction{tdate=enddate, tpostings=nps})
|
putStr $ showTransaction (nulltransaction{tdate=addDays (-1) enddate, tdescription="closing balances", tpostings=nps})
|
||||||
putStr $ showTransactionUnelided (nulltransaction{tdate=enddate, tpostings=ps})
|
putStr $ showTransaction (nulltransaction{tdate=enddate, tdescription="opening balances", tpostings=ps})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user