Merge branch 'master' into installer
This commit is contained in:
		
						commit
						efc75db8d8
					
				@ -19,6 +19,7 @@ module Hledger.Query (
 | 
				
			|||||||
  -- * accessors
 | 
					  -- * accessors
 | 
				
			||||||
  queryIsNull,
 | 
					  queryIsNull,
 | 
				
			||||||
  queryIsAcct,
 | 
					  queryIsAcct,
 | 
				
			||||||
 | 
					  queryIsAmt,
 | 
				
			||||||
  queryIsDepth,
 | 
					  queryIsDepth,
 | 
				
			||||||
  queryIsDate,
 | 
					  queryIsDate,
 | 
				
			||||||
  queryIsDate2,
 | 
					  queryIsDate2,
 | 
				
			||||||
@ -41,6 +42,8 @@ module Hledger.Query (
 | 
				
			|||||||
  matchesAccount,
 | 
					  matchesAccount,
 | 
				
			||||||
  matchesMixedAmount,
 | 
					  matchesMixedAmount,
 | 
				
			||||||
  matchesAmount,
 | 
					  matchesAmount,
 | 
				
			||||||
 | 
					  matchesCommodity,
 | 
				
			||||||
 | 
					  matchesMarketPrice,
 | 
				
			||||||
  words'',
 | 
					  words'',
 | 
				
			||||||
  -- * tests
 | 
					  -- * tests
 | 
				
			||||||
  tests_Hledger_Query
 | 
					  tests_Hledger_Query
 | 
				
			||||||
@ -481,6 +484,10 @@ queryIsAcct :: Query -> Bool
 | 
				
			|||||||
queryIsAcct (Acct _) = True
 | 
					queryIsAcct (Acct _) = True
 | 
				
			||||||
queryIsAcct _ = False
 | 
					queryIsAcct _ = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					queryIsAmt :: Query -> Bool
 | 
				
			||||||
 | 
					queryIsAmt (Amt _ _) = True
 | 
				
			||||||
 | 
					queryIsAmt _         = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
queryIsSym :: Query -> Bool
 | 
					queryIsSym :: Query -> Bool
 | 
				
			||||||
queryIsSym (Sym _) = True
 | 
					queryIsSym (Sym _) = True
 | 
				
			||||||
queryIsSym _ = False
 | 
					queryIsSym _ = False
 | 
				
			||||||
@ -530,33 +537,27 @@ queryEndDate _ _ = Nothing
 | 
				
			|||||||
queryTermDateSpan (Date span) = Just span
 | 
					queryTermDateSpan (Date span) = Just span
 | 
				
			||||||
queryTermDateSpan _ = Nothing
 | 
					queryTermDateSpan _ = Nothing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- | What date span (or secondary date span) does this query specify ?
 | 
					-- | What date span (or with a true argument, what secondary date span) does this query specify ?
 | 
				
			||||||
-- For OR expressions, use the widest possible span. NOT is ignored.
 | 
					-- OR clauses specifying multiple spans return their union (the span enclosing all of them).
 | 
				
			||||||
 | 
					-- AND clauses specifying multiple spans return their intersection.
 | 
				
			||||||
 | 
					-- NOT clauses are ignored.
 | 
				
			||||||
queryDateSpan :: Bool -> Query -> DateSpan
 | 
					queryDateSpan :: Bool -> Query -> DateSpan
 | 
				
			||||||
queryDateSpan secondary q = spansUnion $ queryDateSpans secondary q
 | 
					queryDateSpan secondary (Or qs)  = spansUnion     $ map (queryDateSpan secondary) qs
 | 
				
			||||||
 | 
					queryDateSpan secondary (And qs) = spansIntersect $ map (queryDateSpan secondary) qs
 | 
				
			||||||
 | 
					queryDateSpan False (Date span)  = span
 | 
				
			||||||
 | 
					queryDateSpan True (Date2 span)  = span
 | 
				
			||||||
 | 
					queryDateSpan _ _                = nulldatespan
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- | Extract all date (or secondary date) spans specified in this query.
 | 
					-- | What date span does this query specify, treating primary and secondary dates as equivalent ?
 | 
				
			||||||
-- NOT is ignored.
 | 
					-- OR clauses specifying multiple spans return their union (the span enclosing all of them).
 | 
				
			||||||
queryDateSpans :: Bool -> Query -> [DateSpan]
 | 
					-- AND clauses specifying multiple spans return their intersection.
 | 
				
			||||||
queryDateSpans secondary (Or qs) = concatMap (queryDateSpans secondary) qs
 | 
					-- NOT clauses are ignored.
 | 
				
			||||||
queryDateSpans secondary (And qs) = concatMap (queryDateSpans secondary) qs
 | 
					 | 
				
			||||||
queryDateSpans False (Date span) = [span]
 | 
					 | 
				
			||||||
queryDateSpans True (Date2 span) = [span]
 | 
					 | 
				
			||||||
queryDateSpans _ _ = []
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- | What date span (or secondary date span) does this query specify ?
 | 
					 | 
				
			||||||
-- For OR expressions, use the widest possible span. NOT is ignored.
 | 
					 | 
				
			||||||
queryDateSpan' :: Query -> DateSpan
 | 
					queryDateSpan' :: Query -> DateSpan
 | 
				
			||||||
queryDateSpan' q = spansUnion $ queryDateSpans' q
 | 
					queryDateSpan' (Or qs)      = spansUnion     $ map queryDateSpan' qs
 | 
				
			||||||
 | 
					queryDateSpan' (And qs)     = spansIntersect $ map queryDateSpan' qs
 | 
				
			||||||
-- | Extract all date (or secondary date) spans specified in this query.
 | 
					queryDateSpan' (Date span)  = span
 | 
				
			||||||
-- NOT is ignored.
 | 
					queryDateSpan' (Date2 span) = span
 | 
				
			||||||
queryDateSpans' :: Query -> [DateSpan]
 | 
					queryDateSpan' _            = nulldatespan
 | 
				
			||||||
queryDateSpans' (Or qs) = concatMap queryDateSpans' qs
 | 
					 | 
				
			||||||
queryDateSpans' (And qs) = concatMap queryDateSpans' qs
 | 
					 | 
				
			||||||
queryDateSpans' (Date span) = [span]
 | 
					 | 
				
			||||||
queryDateSpans' (Date2 span) = [span]
 | 
					 | 
				
			||||||
queryDateSpans' _ = []
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- | What is the earliest of these dates, where Nothing is latest ?
 | 
					-- | What is the earliest of these dates, where Nothing is latest ?
 | 
				
			||||||
earliestMaybeDate :: [Maybe Day] -> Maybe Day
 | 
					earliestMaybeDate :: [Maybe Day] -> Maybe Day
 | 
				
			||||||
@ -641,6 +642,10 @@ matchesMixedAmount :: Query -> MixedAmount -> Bool
 | 
				
			|||||||
matchesMixedAmount q (Mixed []) = q `matchesAmount` nullamt
 | 
					matchesMixedAmount q (Mixed []) = q `matchesAmount` nullamt
 | 
				
			||||||
matchesMixedAmount q (Mixed as) = any (q `matchesAmount`) as
 | 
					matchesMixedAmount q (Mixed as) = any (q `matchesAmount`) as
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					matchesCommodity :: Query -> CommoditySymbol -> Bool
 | 
				
			||||||
 | 
					matchesCommodity (Sym r) s = regexMatchesCI ("^" ++ r ++ "$") (T.unpack s)
 | 
				
			||||||
 | 
					matchesCommodity _ _ = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- | Does the match expression match this (simple) amount ?
 | 
					-- | Does the match expression match this (simple) amount ?
 | 
				
			||||||
matchesAmount :: Query -> Amount -> Bool
 | 
					matchesAmount :: Query -> Amount -> Bool
 | 
				
			||||||
matchesAmount (Not q) a = not $ q `matchesAmount` a
 | 
					matchesAmount (Not q) a = not $ q `matchesAmount` a
 | 
				
			||||||
@ -650,7 +655,7 @@ matchesAmount (Or qs) a = any (`matchesAmount` a) qs
 | 
				
			|||||||
matchesAmount (And qs) a = all (`matchesAmount` a) qs
 | 
					matchesAmount (And qs) a = all (`matchesAmount` a) qs
 | 
				
			||||||
--
 | 
					--
 | 
				
			||||||
matchesAmount (Amt ord n) a = compareAmount ord n a
 | 
					matchesAmount (Amt ord n) a = compareAmount ord n a
 | 
				
			||||||
matchesAmount (Sym r) a = regexMatchesCI ("^" ++ r ++ "$") $ T.unpack $ acommodity a
 | 
					matchesAmount (Sym r) a = matchesCommodity (Sym r) (acommodity a)
 | 
				
			||||||
--
 | 
					--
 | 
				
			||||||
matchesAmount _ _ = True
 | 
					matchesAmount _ _ = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -694,7 +699,7 @@ matchesPosting q@(Amt _ _) Posting{pamount=amt} = q `matchesMixedAmount` amt
 | 
				
			|||||||
-- matchesPosting (Empty False) Posting{pamount=a} = True
 | 
					-- matchesPosting (Empty False) Posting{pamount=a} = True
 | 
				
			||||||
-- matchesPosting (Empty True) Posting{pamount=a} = isZeroMixedAmount a
 | 
					-- matchesPosting (Empty True) Posting{pamount=a} = isZeroMixedAmount a
 | 
				
			||||||
matchesPosting (Empty _) _ = True
 | 
					matchesPosting (Empty _) _ = True
 | 
				
			||||||
matchesPosting (Sym r) Posting{pamount=Mixed as} = any (regexMatchesCI $ "^" ++ r ++ "$") $ map (T.unpack . acommodity) as
 | 
					matchesPosting (Sym r) Posting{pamount=Mixed as} = any (matchesCommodity (Sym r)) $ map acommodity as
 | 
				
			||||||
matchesPosting (Tag n v) p = case (n, v) of
 | 
					matchesPosting (Tag n v) p = case (n, v) of
 | 
				
			||||||
  ("payee", Just v) -> maybe False (regexMatchesCI v . T.unpack . transactionPayee) $ ptransaction p
 | 
					  ("payee", Just v) -> maybe False (regexMatchesCI v . T.unpack . transactionPayee) $ ptransaction p
 | 
				
			||||||
  ("note", Just v) -> maybe False (regexMatchesCI v . T.unpack . transactionNote) $ ptransaction p
 | 
					  ("note", Just v) -> maybe False (regexMatchesCI v . T.unpack . transactionNote) $ ptransaction p
 | 
				
			||||||
@ -777,6 +782,18 @@ matchesTags namepat valuepat = not . null . filter (match namepat valuepat)
 | 
				
			|||||||
    match npat Nothing     (n,_) = regexMatchesCI npat (T.unpack n) -- XXX
 | 
					    match npat Nothing     (n,_) = regexMatchesCI npat (T.unpack n) -- XXX
 | 
				
			||||||
    match npat (Just vpat) (n,v) = regexMatchesCI npat (T.unpack n) && regexMatchesCI vpat (T.unpack v)
 | 
					    match npat (Just vpat) (n,v) = regexMatchesCI npat (T.unpack n) && regexMatchesCI vpat (T.unpack v)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- | Does the query match this market price ?
 | 
				
			||||||
 | 
					matchesMarketPrice :: Query -> MarketPrice -> Bool
 | 
				
			||||||
 | 
					matchesMarketPrice (None) _      = False
 | 
				
			||||||
 | 
					matchesMarketPrice (Not q) p     = not $ matchesMarketPrice q p
 | 
				
			||||||
 | 
					matchesMarketPrice (Or qs) p     = any (`matchesMarketPrice` p) qs
 | 
				
			||||||
 | 
					matchesMarketPrice (And qs) p    = all (`matchesMarketPrice` p) qs
 | 
				
			||||||
 | 
					matchesMarketPrice q@(Amt _ _) p = matchesAmount q (mpamount p)
 | 
				
			||||||
 | 
					matchesMarketPrice q@(Sym _) p   = matchesCommodity q (mpcommodity p)
 | 
				
			||||||
 | 
					matchesMarketPrice (Date span) p = spanContainsDate span (mpdate p)
 | 
				
			||||||
 | 
					matchesMarketPrice _ _           = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- tests
 | 
					-- tests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tests_Hledger_Query :: Test
 | 
					tests_Hledger_Query :: Test
 | 
				
			||||||
 | 
				
			|||||||
@ -17,28 +17,34 @@ import System.Console.CmdArgs.Explicit
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
pricesmode = hledgerCommandMode
 | 
					pricesmode = hledgerCommandMode
 | 
				
			||||||
  [here| prices
 | 
					  [here| prices
 | 
				
			||||||
Print all market prices from the journal.
 | 
					Print market price directives from the journal.
 | 
				
			||||||
 | 
					With --costs, also print synthetic market prices based on transaction prices.
 | 
				
			||||||
 | 
					With --inverted-costs, also print inverse prices based on transaction prices.
 | 
				
			||||||
 | 
					Prices (and postings providing prices) can be filtered by a query.
 | 
				
			||||||
  |]
 | 
					  |]
 | 
				
			||||||
  [flagNone ["costs"] (setboolopt "costs") "print transaction prices from postings"
 | 
					  [flagNone ["costs"] (setboolopt "costs") "print transaction prices from postings"
 | 
				
			||||||
  ,flagNone ["inverted-costs"] (setboolopt "inverted-costs") "print transaction inverted prices from postings also"]
 | 
					  ,flagNone ["inverted-costs"] (setboolopt "inverted-costs") "print transaction inverted prices from postings also"]
 | 
				
			||||||
  [generalflagsgroup1]
 | 
					  [generalflagsgroup1]
 | 
				
			||||||
  []
 | 
					  []
 | 
				
			||||||
  ([], Nothing)
 | 
					  ([], Just $ argsFlag "[QUERY]")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- XXX the original hledger-prices script always ignored assertions 
 | 
				
			||||||
prices opts j = do
 | 
					prices opts j = do
 | 
				
			||||||
  -- XXX the original hledger-prices script always ignored assertions 
 | 
					  d <- getCurrentDay
 | 
				
			||||||
  let cprices = concatMap postingCosts . allPostings $ j
 | 
					  let
 | 
				
			||||||
      icprices = concatMap postingCosts . mapAmount invertPrice . allPostings $ j
 | 
					    q          = queryFromOpts d (reportopts_ opts)
 | 
				
			||||||
      printPrices = mapM_ (putStrLn . showPrice)
 | 
					    ps         = filter (matchesPosting q) $ allPostings j
 | 
				
			||||||
      forBoolOpt opt | boolopt opt $ rawopts_ opts = id
 | 
					    mprices    = jmarketprices j
 | 
				
			||||||
                     | otherwise = const []
 | 
					    cprices    = concatMap postingCosts ps
 | 
				
			||||||
      allPrices = sortOn mpdate . concat $
 | 
					    icprices   = concatMap postingCosts . mapAmount invertPrice $ ps
 | 
				
			||||||
          [ jmarketprices j
 | 
					    allprices  = mprices ++ ifBoolOpt "costs" cprices ++ ifBoolOpt "inverted-costs" icprices
 | 
				
			||||||
          , forBoolOpt "costs" cprices
 | 
					  mapM_ (putStrLn . showPrice) $
 | 
				
			||||||
          , forBoolOpt "inverted-costs" icprices
 | 
					    sortOn mpdate $
 | 
				
			||||||
          ]
 | 
					    filter (matchesMarketPrice q) $
 | 
				
			||||||
  
 | 
					    allprices
 | 
				
			||||||
  printPrices allPrices
 | 
					  where
 | 
				
			||||||
 | 
					    ifBoolOpt opt | boolopt opt $ rawopts_ opts = id
 | 
				
			||||||
 | 
					                  | otherwise = const []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
showPrice :: MarketPrice -> String
 | 
					showPrice :: MarketPrice -> String
 | 
				
			||||||
showPrice mp = unwords ["P", show $ mpdate mp, T.unpack . quoteCommoditySymbolIfNeeded $ mpcommodity mp, showAmountWithZeroCommodity $ mpamount mp]
 | 
					showPrice mp = unwords ["P", show $ mpdate mp, T.unpack . quoteCommoditySymbolIfNeeded $ mpcommodity mp, showAmountWithZeroCommodity $ mpamount mp]
 | 
				
			||||||
 | 
				
			|||||||
@ -2426,7 +2426,12 @@ This command also supports output destination and output format
 | 
				
			|||||||
selection.
 | 
					selection.
 | 
				
			||||||
.SS prices
 | 
					.SS prices
 | 
				
			||||||
.PP
 | 
					.PP
 | 
				
			||||||
Print all market prices from the journal.
 | 
					Print market price directives from the journal.
 | 
				
			||||||
 | 
					With \[en]costs, also print synthetic market prices based on transaction
 | 
				
			||||||
 | 
					prices.
 | 
				
			||||||
 | 
					With \[en]inverted\-costs, also print inverse prices based on
 | 
				
			||||||
 | 
					transaction prices.
 | 
				
			||||||
 | 
					Prices (and postings providing prices) can be filtered by a query.
 | 
				
			||||||
.SS print
 | 
					.SS print
 | 
				
			||||||
.PP
 | 
					.PP
 | 
				
			||||||
Show transactions from the journal.
 | 
					Show transactions from the journal.
 | 
				
			||||||
 | 
				
			|||||||
@ -1921,7 +1921,10 @@ File: hledger.info,  Node: prices,  Next: print,  Prev: incomestatement,  Up: CO
 | 
				
			|||||||
4.14 prices
 | 
					4.14 prices
 | 
				
			||||||
===========
 | 
					===========
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Print all market prices from the journal.
 | 
					Print market price directives from the journal.  With -costs, also print
 | 
				
			||||||
 | 
					synthetic market prices based on transaction prices.  With
 | 
				
			||||||
 | 
					-inverted-costs, also print inverse prices based on transaction prices.
 | 
				
			||||||
 | 
					Prices (and postings providing prices) can be filtered by a query.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
File: hledger.info,  Node: print,  Next: print-unique,  Prev: prices,  Up: COMMANDS
 | 
					File: hledger.info,  Node: print,  Next: print-unique,  Prev: prices,  Up: COMMANDS
 | 
				
			||||||
@ -2520,51 +2523,51 @@ Node: incomestatement61310
 | 
				
			|||||||
Ref: #incomestatement61444
 | 
					Ref: #incomestatement61444
 | 
				
			||||||
Node: prices63848
 | 
					Node: prices63848
 | 
				
			||||||
Ref: #prices63963
 | 
					Ref: #prices63963
 | 
				
			||||||
Node: print64006
 | 
					Node: print64235
 | 
				
			||||||
Ref: #print64116
 | 
					Ref: #print64345
 | 
				
			||||||
Node: print-unique69010
 | 
					Node: print-unique69239
 | 
				
			||||||
Ref: #print-unique69136
 | 
					Ref: #print-unique69365
 | 
				
			||||||
Node: register69204
 | 
					Node: register69433
 | 
				
			||||||
Ref: #register69331
 | 
					Ref: #register69560
 | 
				
			||||||
Node: Custom register output73832
 | 
					Node: Custom register output74061
 | 
				
			||||||
Ref: #custom-register-output73961
 | 
					Ref: #custom-register-output74190
 | 
				
			||||||
Node: register-match75191
 | 
					Node: register-match75420
 | 
				
			||||||
Ref: #register-match75325
 | 
					Ref: #register-match75554
 | 
				
			||||||
Node: rewrite75508
 | 
					Node: rewrite75737
 | 
				
			||||||
Ref: #rewrite75625
 | 
					Ref: #rewrite75854
 | 
				
			||||||
Node: stats75694
 | 
					Node: stats75923
 | 
				
			||||||
Ref: #stats75797
 | 
					Ref: #stats76026
 | 
				
			||||||
Node: tags76667
 | 
					Node: tags76896
 | 
				
			||||||
Ref: #tags76765
 | 
					Ref: #tags76994
 | 
				
			||||||
Node: test77001
 | 
					Node: test77230
 | 
				
			||||||
Ref: #test77085
 | 
					Ref: #test77314
 | 
				
			||||||
Node: ADD-ON COMMANDS77453
 | 
					Node: ADD-ON COMMANDS77682
 | 
				
			||||||
Ref: #add-on-commands77563
 | 
					Ref: #add-on-commands77792
 | 
				
			||||||
Node: Official add-ons78850
 | 
					Node: Official add-ons79079
 | 
				
			||||||
Ref: #official-add-ons78990
 | 
					Ref: #official-add-ons79219
 | 
				
			||||||
Node: api79077
 | 
					Node: api79306
 | 
				
			||||||
Ref: #api79166
 | 
					Ref: #api79395
 | 
				
			||||||
Node: ui79218
 | 
					Node: ui79447
 | 
				
			||||||
Ref: #ui79317
 | 
					Ref: #ui79546
 | 
				
			||||||
Node: web79375
 | 
					Node: web79604
 | 
				
			||||||
Ref: #web79464
 | 
					Ref: #web79693
 | 
				
			||||||
Node: Third party add-ons79510
 | 
					Node: Third party add-ons79739
 | 
				
			||||||
Ref: #third-party-add-ons79685
 | 
					Ref: #third-party-add-ons79914
 | 
				
			||||||
Node: diff79820
 | 
					Node: diff80049
 | 
				
			||||||
Ref: #diff79917
 | 
					Ref: #diff80146
 | 
				
			||||||
Node: iadd80016
 | 
					Node: iadd80245
 | 
				
			||||||
Ref: #iadd80130
 | 
					Ref: #iadd80359
 | 
				
			||||||
Node: interest80213
 | 
					Node: interest80442
 | 
				
			||||||
Ref: #interest80334
 | 
					Ref: #interest80563
 | 
				
			||||||
Node: irr80429
 | 
					Node: irr80658
 | 
				
			||||||
Ref: #irr80527
 | 
					Ref: #irr80756
 | 
				
			||||||
Node: Experimental add-ons80605
 | 
					Node: Experimental add-ons80834
 | 
				
			||||||
Ref: #experimental-add-ons80757
 | 
					Ref: #experimental-add-ons80986
 | 
				
			||||||
Node: autosync81037
 | 
					Node: autosync81266
 | 
				
			||||||
Ref: #autosync81148
 | 
					Ref: #autosync81377
 | 
				
			||||||
Node: chart81387
 | 
					Node: chart81616
 | 
				
			||||||
Ref: #chart81506
 | 
					Ref: #chart81735
 | 
				
			||||||
Node: check81577
 | 
					Node: check81806
 | 
				
			||||||
Ref: #check81679
 | 
					Ref: #check81908
 | 
				
			||||||
 | 
					
 | 
				
			||||||
End Tag Table
 | 
					End Tag Table
 | 
				
			||||||
 | 
				
			|||||||
@ -1727,13 +1727,16 @@ COMMANDS
 | 
				
			|||||||
       tion.
 | 
					       tion.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   prices
 | 
					   prices
 | 
				
			||||||
       Print all market prices from the journal.
 | 
					       Print market price directives from  the  journal.   With  -costs,  also
 | 
				
			||||||
 | 
					       print  synthetic  market  prices  based  on  transaction  prices.  With
 | 
				
			||||||
 | 
					       -inverted-costs, also print inverse prices based on transaction prices.
 | 
				
			||||||
 | 
					       Prices (and postings providing prices) can be filtered by a query.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   print
 | 
					   print
 | 
				
			||||||
       Show transactions from the journal.  Aliases: p, txns.
 | 
					       Show transactions from the journal.  Aliases: p, txns.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       -m STR --match=STR
 | 
					       -m STR --match=STR
 | 
				
			||||||
              show the transaction whose description is most similar  to  STR,
 | 
					              show  the  transaction whose description is most similar to STR,
 | 
				
			||||||
              and is most recent
 | 
					              and is most recent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       --new  show only newer-dated transactions added in each file since last
 | 
					       --new  show only newer-dated transactions added in each file since last
 | 
				
			||||||
@ -1746,7 +1749,7 @@ COMMANDS
 | 
				
			|||||||
              select the output format.  Supported formats: txt, csv.
 | 
					              select the output format.  Supported formats: txt, csv.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       -o FILE --output-file=FILE
 | 
					       -o FILE --output-file=FILE
 | 
				
			||||||
              write output to FILE.  A file  extension  matching  one  of  the
 | 
					              write  output  to  FILE.   A  file extension matching one of the
 | 
				
			||||||
              above formats selects that format.
 | 
					              above formats selects that format.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              $ hledger print
 | 
					              $ hledger print
 | 
				
			||||||
@ -1777,39 +1780,39 @@ COMMANDS
 | 
				
			|||||||
       it does not preserve directives or inter-transaction comments
 | 
					       it does not preserve directives or inter-transaction comments
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       Normally, the journal entry's explicit or implicit amount style is pre-
 | 
					       Normally, the journal entry's explicit or implicit amount style is pre-
 | 
				
			||||||
       served.   Ie when an amount is omitted in the journal, it will be omit-
 | 
					       served.  Ie when an amount is omitted in the journal, it will be  omit-
 | 
				
			||||||
       ted in the output.  You can use the  -x/--explicit  flag  to  make  all
 | 
					       ted  in  the  output.   You  can use the -x/--explicit flag to make all
 | 
				
			||||||
       amounts explicit, which can be useful for troubleshooting or for making
 | 
					       amounts explicit, which can be useful for troubleshooting or for making
 | 
				
			||||||
       your journal more readable and robust against data entry errors.  Note,
 | 
					       your journal more readable and robust against data entry errors.  Note,
 | 
				
			||||||
       -x  will  cause postings with a multi-commodity amount (these can arise
 | 
					       -x will cause postings with a multi-commodity amount (these  can  arise
 | 
				
			||||||
       when a multi-commodity transaction has  an  implicit  amount)  will  be
 | 
					       when  a  multi-commodity  transaction  has  an implicit amount) will be
 | 
				
			||||||
       split  into  multiple single-commodity postings, for valid journal out-
 | 
					       split into multiple single-commodity postings, for valid  journal  out-
 | 
				
			||||||
       put.
 | 
					       put.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       With -B/--cost, amounts with transaction prices are converted  to  cost
 | 
					       With  -B/--cost,  amounts with transaction prices are converted to cost
 | 
				
			||||||
       using that price.  This can be used for troubleshooting.
 | 
					       using that price.  This can be used for troubleshooting.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       With  -m/--match and a STR argument, print will show at most one trans-
 | 
					       With -m/--match and a STR argument, print will show at most one  trans-
 | 
				
			||||||
       action: the one one whose description is most similar to  STR,  and  is
 | 
					       action:  the  one  one whose description is most similar to STR, and is
 | 
				
			||||||
       most  recent.  STR should contain at least two characters.  If there is
 | 
					       most recent.  STR should contain at least two characters.  If there  is
 | 
				
			||||||
       no similar-enough match, no transaction will be shown.
 | 
					       no similar-enough match, no transaction will be shown.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       With --new, for each FILE being read, hledger reads (and writes) a spe-
 | 
					       With --new, for each FILE being read, hledger reads (and writes) a spe-
 | 
				
			||||||
       cial  state  file  (.latest.FILE in the same directory), containing the
 | 
					       cial state file (.latest.FILE in the same  directory),  containing  the
 | 
				
			||||||
       latest transaction date(s) that were seen  last  time  FILE  was  read.
 | 
					       latest  transaction  date(s)  that  were  seen last time FILE was read.
 | 
				
			||||||
       When  this  file  is found, only transactions with newer dates (and new
 | 
					       When this file is found, only transactions with newer  dates  (and  new
 | 
				
			||||||
       transactions on the latest date)  are  printed.   This  is  useful  for
 | 
					       transactions  on  the  latest  date)  are  printed.  This is useful for
 | 
				
			||||||
       ignoring  already-seen  entries  in import data, such as downloaded CSV
 | 
					       ignoring already-seen entries in import data, such  as  downloaded  CSV
 | 
				
			||||||
       files.  Eg:
 | 
					       files.  Eg:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              $ hledger -f bank1.csv print --new
 | 
					              $ hledger -f bank1.csv print --new
 | 
				
			||||||
              # shows transactions added since last print --new on this file
 | 
					              # shows transactions added since last print --new on this file
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       This assumes that transactions  added  to  FILE  always  have  same  or
 | 
					       This  assumes  that  transactions  added  to  FILE  always have same or
 | 
				
			||||||
       increasing  dates,  and  that  transactions  on the same day do not get
 | 
					       increasing dates, and that transactions on the  same  day  do  not  get
 | 
				
			||||||
       reordered.  See also the import command.
 | 
					       reordered.  See also the import command.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       This command also supports output destination and output format  selec-
 | 
					       This  command also supports output destination and output format selec-
 | 
				
			||||||
       tion.  Here's an example of print's CSV output:
 | 
					       tion.  Here's an example of print's CSV output:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              $ hledger print -Ocsv
 | 
					              $ hledger print -Ocsv
 | 
				
			||||||
@ -1826,20 +1829,20 @@ COMMANDS
 | 
				
			|||||||
              "5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""
 | 
					              "5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""
 | 
				
			||||||
              "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""
 | 
					              "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       o There  is  one  CSV record per posting, with the parent transaction's
 | 
					       o There is one CSV record per posting, with  the  parent  transaction's
 | 
				
			||||||
         fields repeated.
 | 
					         fields repeated.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       o The "txnidx" (transaction index) field shows which postings belong to
 | 
					       o The "txnidx" (transaction index) field shows which postings belong to
 | 
				
			||||||
         the  same transaction.  (This number might change if transactions are
 | 
					         the same transaction.  (This number might change if transactions  are
 | 
				
			||||||
         reordered within the file, files are parsed/included in  a  different
 | 
					         reordered  within  the file, files are parsed/included in a different
 | 
				
			||||||
         order, etc.)
 | 
					         order, etc.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       o The  amount  is  separated into "commodity" (the symbol) and "amount"
 | 
					       o The amount is separated into "commodity" (the  symbol)  and  "amount"
 | 
				
			||||||
         (numeric quantity) fields.
 | 
					         (numeric quantity) fields.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       o The numeric amount is repeated in either the "credit" or "debit" col-
 | 
					       o The numeric amount is repeated in either the "credit" or "debit" col-
 | 
				
			||||||
         umn,  for convenience.  (Those names are not accurate in the account-
 | 
					         umn, for convenience.  (Those names are not accurate in the  account-
 | 
				
			||||||
         ing sense; it just puts negative amounts under  credit  and  zero  or
 | 
					         ing  sense;  it  just  puts negative amounts under credit and zero or
 | 
				
			||||||
         greater amounts under debit.)
 | 
					         greater amounts under debit.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   print-unique
 | 
					   print-unique
 | 
				
			||||||
@ -1852,7 +1855,7 @@ COMMANDS
 | 
				
			|||||||
              show running total from report start date (default)
 | 
					              show running total from report start date (default)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       -H --historical
 | 
					       -H --historical
 | 
				
			||||||
              show  historical running total/balance (includes postings before
 | 
					              show historical running total/balance (includes postings  before
 | 
				
			||||||
              report start date)
 | 
					              report start date)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       -A --average
 | 
					       -A --average
 | 
				
			||||||
@ -1863,18 +1866,18 @@ COMMANDS
 | 
				
			|||||||
              show postings' siblings instead
 | 
					              show postings' siblings instead
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       -w N --width=N
 | 
					       -w N --width=N
 | 
				
			||||||
              set  output  width  (default:  terminal width or COLUMNS.  -wN,M
 | 
					              set output width (default: terminal  width  or  COLUMNS.   -wN,M
 | 
				
			||||||
              sets description width as well)
 | 
					              sets description width as well)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       -O FMT --output-format=FMT
 | 
					       -O FMT --output-format=FMT
 | 
				
			||||||
              select the output format.  Supported formats: txt, csv.
 | 
					              select the output format.  Supported formats: txt, csv.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       -o FILE --output-file=FILE
 | 
					       -o FILE --output-file=FILE
 | 
				
			||||||
              write output to FILE.  A file  extension  matching  one  of  the
 | 
					              write  output  to  FILE.   A  file extension matching one of the
 | 
				
			||||||
              above formats selects that format.
 | 
					              above formats selects that format.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       The register command displays postings, one per line, and their running
 | 
					       The register command displays postings, one per line, and their running
 | 
				
			||||||
       total.  This is typically used with  a  query  selecting  a  particular
 | 
					       total.   This  is  typically  used  with a query selecting a particular
 | 
				
			||||||
       account, to see that account's activity:
 | 
					       account, to see that account's activity:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              $ hledger register checking
 | 
					              $ hledger register checking
 | 
				
			||||||
@ -1883,8 +1886,8 @@ COMMANDS
 | 
				
			|||||||
              2008/06/02 save                 assets:bank:checking           $-1            $1
 | 
					              2008/06/02 save                 assets:bank:checking           $-1            $1
 | 
				
			||||||
              2008/12/31 pay off              assets:bank:checking           $-1             0
 | 
					              2008/12/31 pay off              assets:bank:checking           $-1             0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       The  --historical/-H  flag  adds the balance from any undisplayed prior
 | 
					       The --historical/-H flag adds the balance from  any  undisplayed  prior
 | 
				
			||||||
       postings to the running total.  This is useful when  you  want  to  see
 | 
					       postings  to  the  running  total.  This is useful when you want to see
 | 
				
			||||||
       only recent activity, with a historically accurate running balance:
 | 
					       only recent activity, with a historically accurate running balance:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              $ hledger register checking -b 2008/6 --historical
 | 
					              $ hledger register checking -b 2008/6 --historical
 | 
				
			||||||
@ -1894,23 +1897,23 @@ COMMANDS
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
       The --depth option limits the amount of sub-account detail displayed.
 | 
					       The --depth option limits the amount of sub-account detail displayed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       The  --average/-A flag shows the running average posting amount instead
 | 
					       The --average/-A flag shows the running average posting amount  instead
 | 
				
			||||||
       of the running total (so, the final number displayed is the average for
 | 
					       of the running total (so, the final number displayed is the average for
 | 
				
			||||||
       the  whole  report period).  This flag implies --empty (see below).  It
 | 
					       the whole report period).  This flag implies --empty (see  below).   It
 | 
				
			||||||
       is affected by --historical.  It  works  best  when  showing  just  one
 | 
					       is  affected  by  --historical.   It  works  best when showing just one
 | 
				
			||||||
       account and one commodity.
 | 
					       account and one commodity.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       The  --related/-r  flag shows the other postings in the transactions of
 | 
					       The --related/-r flag shows the other postings in the  transactions  of
 | 
				
			||||||
       the postings which would normally be shown.
 | 
					       the postings which would normally be shown.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       With a reporting interval, register shows  summary  postings,  one  per
 | 
					       With  a  reporting  interval,  register shows summary postings, one per
 | 
				
			||||||
       interval, aggregating the postings to each account:
 | 
					       interval, aggregating the postings to each account:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              $ hledger register --monthly income
 | 
					              $ hledger register --monthly income
 | 
				
			||||||
              2008/01                 income:salary                          $-1           $-1
 | 
					              2008/01                 income:salary                          $-1           $-1
 | 
				
			||||||
              2008/06                 income:gifts                           $-1           $-2
 | 
					              2008/06                 income:gifts                           $-1           $-2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       Periods  with no activity, and summary postings with a zero amount, are
 | 
					       Periods with no activity, and summary postings with a zero amount,  are
 | 
				
			||||||
       not shown by default; use the --empty/-E flag to see them:
 | 
					       not shown by default; use the --empty/-E flag to see them:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              $ hledger register --monthly income -E
 | 
					              $ hledger register --monthly income -E
 | 
				
			||||||
@ -1927,7 +1930,7 @@ COMMANDS
 | 
				
			|||||||
              2008/11                                                          0           $-2
 | 
					              2008/11                                                          0           $-2
 | 
				
			||||||
              2008/12                                                          0           $-2
 | 
					              2008/12                                                          0           $-2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       Often, you'll want to see just one  line  per  interval.   The  --depth
 | 
					       Often,  you'll  want  to  see  just one line per interval.  The --depth
 | 
				
			||||||
       option helps with this, causing subaccounts to be aggregated:
 | 
					       option helps with this, causing subaccounts to be aggregated:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              $ hledger register --monthly assets --depth 1h
 | 
					              $ hledger register --monthly assets --depth 1h
 | 
				
			||||||
@ -1935,18 +1938,18 @@ COMMANDS
 | 
				
			|||||||
              2008/06                 assets                                 $-1             0
 | 
					              2008/06                 assets                                 $-1             0
 | 
				
			||||||
              2008/12                 assets                                 $-1           $-1
 | 
					              2008/12                 assets                                 $-1           $-1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       Note  when using report intervals, if you specify start/end dates these
 | 
					       Note when using report intervals, if you specify start/end dates  these
 | 
				
			||||||
       will be adjusted outward if necessary to  contain  a  whole  number  of
 | 
					       will  be  adjusted  outward  if  necessary to contain a whole number of
 | 
				
			||||||
       intervals.   This  ensures  that  the first and last intervals are full
 | 
					       intervals.  This ensures that the first and  last  intervals  are  full
 | 
				
			||||||
       length and comparable to the others in the report.
 | 
					       length and comparable to the others in the report.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   Custom register output
 | 
					   Custom register output
 | 
				
			||||||
       register uses the full terminal width by default,  except  on  windows.
 | 
					       register  uses  the  full terminal width by default, except on windows.
 | 
				
			||||||
       You  can override this by setting the COLUMNS environment variable (not
 | 
					       You can override this by setting the COLUMNS environment variable  (not
 | 
				
			||||||
       a bash shell variable) or by using the --width/-w option.
 | 
					       a bash shell variable) or by using the --width/-w option.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       The description and account columns normally share  the  space  equally
 | 
					       The  description  and  account columns normally share the space equally
 | 
				
			||||||
       (about  half  of  (width  - 40) each).  You can adjust this by adding a
 | 
					       (about half of (width - 40) each).  You can adjust  this  by  adding  a
 | 
				
			||||||
       description  width  as  part  of  -width's  argument,  comma-separated:
 | 
					       description  width  as  part  of  -width's  argument,  comma-separated:
 | 
				
			||||||
       --width W,D .  Here's a diagram:
 | 
					       --width W,D .  Here's a diagram:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1963,12 +1966,12 @@ COMMANDS
 | 
				
			|||||||
              $ hledger reg -w 100,40           # set overall width 100, description width 40
 | 
					              $ hledger reg -w 100,40           # set overall width 100, description width 40
 | 
				
			||||||
              $ hledger reg -w $COLUMNS,40      # use terminal width, and set description width
 | 
					              $ hledger reg -w $COLUMNS,40      # use terminal width, and set description width
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       This  command also supports output destination and output format selec-
 | 
					       This command also supports output destination and output format  selec-
 | 
				
			||||||
       tion.
 | 
					       tion.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   register-match
 | 
					   register-match
 | 
				
			||||||
       Print the one posting whose transaction description is closest to DESC,
 | 
					       Print the one posting whose transaction description is closest to DESC,
 | 
				
			||||||
       in  the  style  of  the register command.  Helps ledger-autosync detect
 | 
					       in the style of the register  command.   Helps  ledger-autosync  detect
 | 
				
			||||||
       already-seen transactions when importing.
 | 
					       already-seen transactions when importing.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   rewrite
 | 
					   rewrite
 | 
				
			||||||
@ -1978,7 +1981,7 @@ COMMANDS
 | 
				
			|||||||
       Show some journal statistics.
 | 
					       Show some journal statistics.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       -o FILE --output-file=FILE
 | 
					       -o FILE --output-file=FILE
 | 
				
			||||||
              write output to FILE.  A file  extension  matching  one  of  the
 | 
					              write  output  to  FILE.   A  file extension matching one of the
 | 
				
			||||||
              above formats selects that format.
 | 
					              above formats selects that format.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              $ hledger stats
 | 
					              $ hledger stats
 | 
				
			||||||
@ -1993,16 +1996,16 @@ COMMANDS
 | 
				
			|||||||
              Accounts                 : 8 (depth 3)
 | 
					              Accounts                 : 8 (depth 3)
 | 
				
			||||||
              Commodities              : 1 ($)
 | 
					              Commodities              : 1 ($)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       The  stats  command displays summary information for the whole journal,
 | 
					       The stats command displays summary information for the  whole  journal,
 | 
				
			||||||
       or a matched part of it.  With a reporting interval, it shows a  report
 | 
					       or  a matched part of it.  With a reporting interval, it shows a report
 | 
				
			||||||
       for each report period.
 | 
					       for each report period.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       This  command also supports output destination and output format selec-
 | 
					       This command also supports output destination and output format  selec-
 | 
				
			||||||
       tion.
 | 
					       tion.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   tags
 | 
					   tags
 | 
				
			||||||
       List all the tag names used in the journal.  With a TAGREGEX  argument,
 | 
					       List  all the tag names used in the journal.  With a TAGREGEX argument,
 | 
				
			||||||
       only  tag  names matching the regular expression (case insensitive) are
 | 
					       only tag names matching the regular expression (case  insensitive)  are
 | 
				
			||||||
       shown.  With additional QUERY arguments, only transactions matching the
 | 
					       shown.  With additional QUERY arguments, only transactions matching the
 | 
				
			||||||
       query are considered.
 | 
					       query are considered.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2012,34 +2015,34 @@ COMMANDS
 | 
				
			|||||||
              $ hledger test
 | 
					              $ hledger test
 | 
				
			||||||
              Cases: 74  Tried: 74  Errors: 0  Failures: 0
 | 
					              Cases: 74  Tried: 74  Errors: 0  Failures: 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       This  command  runs  hledger's built-in unit tests and displays a quick
 | 
					       This command runs hledger's built-in unit tests and  displays  a  quick
 | 
				
			||||||
       report.  With a regular expression argument, it selects only tests with
 | 
					       report.  With a regular expression argument, it selects only tests with
 | 
				
			||||||
       matching names.  It's mainly used in development, but it's also nice to
 | 
					       matching names.  It's mainly used in development, but it's also nice to
 | 
				
			||||||
       be able to check your hledger executable for smoke at any time.
 | 
					       be able to check your hledger executable for smoke at any time.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ADD-ON COMMANDS
 | 
					ADD-ON COMMANDS
 | 
				
			||||||
       hledger also searches for external add-on commands,  and  will  include
 | 
					       hledger  also  searches  for external add-on commands, and will include
 | 
				
			||||||
       these in the commands list.  These are programs or scripts in your PATH
 | 
					       these in the commands list.  These are programs or scripts in your PATH
 | 
				
			||||||
       whose name starts with hledger- and ends with a recognised file  exten-
 | 
					       whose  name starts with hledger- and ends with a recognised file exten-
 | 
				
			||||||
       sion (currently: no extension, bat,com,exe, hs,lhs,pl,py,rb,rkt,sh).
 | 
					       sion (currently: no extension, bat,com,exe, hs,lhs,pl,py,rb,rkt,sh).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       Add-ons  can  be  invoked like any hledger command, but there are a few
 | 
					       Add-ons can be invoked like any hledger command, but there  are  a  few
 | 
				
			||||||
       things to be aware of.  Eg if the hledger-web add-on is installed,
 | 
					       things to be aware of.  Eg if the hledger-web add-on is installed,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       o hledger -h web  shows  hledger's  help,  while  hledger web -h  shows
 | 
					       o hledger -h web  shows  hledger's  help,  while  hledger web -h  shows
 | 
				
			||||||
         hledger-web's help.
 | 
					         hledger-web's help.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       o Flags  specific  to  the add-on must have a preceding -- to hide them
 | 
					       o Flags specific to the add-on must have a preceding --  to  hide  them
 | 
				
			||||||
         from hledger.  So hledger web --serve --port 9000 will  be  rejected;
 | 
					         from  hledger.   So hledger web --serve --port 9000 will be rejected;
 | 
				
			||||||
         you must use hledger web -- --serve --port 9000.
 | 
					         you must use hledger web -- --serve --port 9000.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       o You    can    always    run    add-ons    directly    if   preferred:
 | 
					       o You   can    always    run    add-ons    directly    if    preferred:
 | 
				
			||||||
         hledger-web --serve --port 9000.
 | 
					         hledger-web --serve --port 9000.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       Add-ons are a relatively easy way to add local features  or  experiment
 | 
					       Add-ons  are  a relatively easy way to add local features or experiment
 | 
				
			||||||
       with  new  ideas.   They  can  be  written in any language, but haskell
 | 
					       with new ideas.  They can be  written  in  any  language,  but  haskell
 | 
				
			||||||
       scripts have a big advantage:  they  can  use  the  same  hledger  (and
 | 
					       scripts  have  a  big  advantage:  they  can  use the same hledger (and
 | 
				
			||||||
       haskell)  library functions that built-in commands do, for command-line
 | 
					       haskell) library functions that built-in commands do, for  command-line
 | 
				
			||||||
       options, journal parsing, reporting, etc.
 | 
					       options, journal parsing, reporting, etc.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       Here are some hledger add-ons available:
 | 
					       Here are some hledger add-ons available:
 | 
				
			||||||
@ -2057,7 +2060,7 @@ ADD-ON COMMANDS
 | 
				
			|||||||
       hledger-web provides a simple web interface.
 | 
					       hledger-web provides a simple web interface.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   Third party add-ons
 | 
					   Third party add-ons
 | 
				
			||||||
       These are maintained separately, and usually updated  shortly  after  a
 | 
					       These  are  maintained  separately, and usually updated shortly after a
 | 
				
			||||||
       hledger release.
 | 
					       hledger release.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   diff
 | 
					   diff
 | 
				
			||||||
@ -2065,7 +2068,7 @@ ADD-ON COMMANDS
 | 
				
			|||||||
       journal file and another.
 | 
					       journal file and another.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   iadd
 | 
					   iadd
 | 
				
			||||||
       hledger-iadd is a curses-style, more interactive  replacement  for  the
 | 
					       hledger-iadd  is  a  curses-style, more interactive replacement for the
 | 
				
			||||||
       add command.
 | 
					       add command.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   interest
 | 
					   interest
 | 
				
			||||||
@ -2073,19 +2076,19 @@ ADD-ON COMMANDS
 | 
				
			|||||||
       ing to various schemes.
 | 
					       ing to various schemes.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   irr
 | 
					   irr
 | 
				
			||||||
       hledger-irr calculates the internal rate of  return  of  an  investment
 | 
					       hledger-irr  calculates  the  internal  rate of return of an investment
 | 
				
			||||||
       account.
 | 
					       account.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   Experimental add-ons
 | 
					   Experimental add-ons
 | 
				
			||||||
       These  are  available  in source form in the hledger repo's bin/ direc-
 | 
					       These are available in source form in the hledger  repo's  bin/  direc-
 | 
				
			||||||
       tory; installing them is pretty easy.  They may be less mature and doc-
 | 
					       tory; installing them is pretty easy.  They may be less mature and doc-
 | 
				
			||||||
       umented  than  built-in commands.  Reading and tweaking these is a good
 | 
					       umented than built-in commands.  Reading and tweaking these is  a  good
 | 
				
			||||||
       way to start making your own!
 | 
					       way to start making your own!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   autosync
 | 
					   autosync
 | 
				
			||||||
       hledger-autosync is a symbolic link for easily running ledger-autosync,
 | 
					       hledger-autosync is a symbolic link for easily running ledger-autosync,
 | 
				
			||||||
       if  installed.   ledger-autosync  does  deduplicating conversion of OFX
 | 
					       if installed.  ledger-autosync does  deduplicating  conversion  of  OFX
 | 
				
			||||||
       data and some CSV formats, and can also download the data if your  bank
 | 
					       data  and some CSV formats, and can also download the data if your bank
 | 
				
			||||||
       offers OFX Direct Connect.
 | 
					       offers OFX Direct Connect.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   chart
 | 
					   chart
 | 
				
			||||||
@ -2095,21 +2098,21 @@ ADD-ON COMMANDS
 | 
				
			|||||||
       hledger-check.hs checks more powerful account balance assertions.
 | 
					       hledger-check.hs checks more powerful account balance assertions.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ENVIRONMENT
 | 
					ENVIRONMENT
 | 
				
			||||||
       COLUMNS  The  screen  width used by the register command.  Default: the
 | 
					       COLUMNS The screen width used by the register  command.   Default:  the
 | 
				
			||||||
       full terminal width.
 | 
					       full terminal width.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       LEDGER_FILE The journal file path when not specified with -f.  Default:
 | 
					       LEDGER_FILE The journal file path when not specified with -f.  Default:
 | 
				
			||||||
       ~/.hledger.journal  (on  windows,  perhaps C:/Users/USER/.hledger.jour-
 | 
					       ~/.hledger.journal (on  windows,  perhaps  C:/Users/USER/.hledger.jour-
 | 
				
			||||||
       nal).
 | 
					       nal).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FILES
 | 
					FILES
 | 
				
			||||||
       Reads data from one or more files in hledger journal, timeclock,  time-
 | 
					       Reads  data from one or more files in hledger journal, timeclock, time-
 | 
				
			||||||
       dot,   or   CSV   format   specified   with  -f,  or  $LEDGER_FILE,  or
 | 
					       dot,  or  CSV  format  specified   with   -f,   or   $LEDGER_FILE,   or
 | 
				
			||||||
       $HOME/.hledger.journal          (on          windows,           perhaps
 | 
					       $HOME/.hledger.journal           (on          windows,          perhaps
 | 
				
			||||||
       C:/Users/USER/.hledger.journal).
 | 
					       C:/Users/USER/.hledger.journal).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BUGS
 | 
					BUGS
 | 
				
			||||||
       The  need  to  precede  addon command options with -- when invoked from
 | 
					       The need to precede addon command options with  --  when  invoked  from
 | 
				
			||||||
       hledger is awkward.
 | 
					       hledger is awkward.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       When input data contains non-ascii characters, a suitable system locale
 | 
					       When input data contains non-ascii characters, a suitable system locale
 | 
				
			||||||
@ -2122,33 +2125,33 @@ BUGS
 | 
				
			|||||||
       In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger
 | 
					       In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger
 | 
				
			||||||
       add.
 | 
					       add.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       Not all of Ledger's journal file syntax is supported.  See file  format
 | 
					       Not  all of Ledger's journal file syntax is supported.  See file format
 | 
				
			||||||
       differences.
 | 
					       differences.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       On  large  data  files,  hledger  is  slower  and uses more memory than
 | 
					       On large data files, hledger  is  slower  and  uses  more  memory  than
 | 
				
			||||||
       Ledger.
 | 
					       Ledger.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TROUBLESHOOTING
 | 
					TROUBLESHOOTING
 | 
				
			||||||
       Here are some issues you might encounter  when  you  run  hledger  (and
 | 
					       Here  are  some  issues  you  might encounter when you run hledger (and
 | 
				
			||||||
       remember  you can also seek help from the IRC channel, mail list or bug
 | 
					       remember you can also seek help from the IRC channel, mail list or  bug
 | 
				
			||||||
       tracker):
 | 
					       tracker):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       Successfully installed, but "No command `hledger' found"
 | 
					       Successfully installed, but "No command `hledger' found"
 | 
				
			||||||
       stack and cabal install binaries into a special directory, which should
 | 
					       stack and cabal install binaries into a special directory, which should
 | 
				
			||||||
       be  added  to your PATH environment variable.  Eg on unix-like systems,
 | 
					       be added to your PATH environment variable.  Eg on  unix-like  systems,
 | 
				
			||||||
       that is ~/.local/bin and ~/.cabal/bin respectively.
 | 
					       that is ~/.local/bin and ~/.cabal/bin respectively.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       I set a custom LEDGER_FILE, but hledger is still using the default file
 | 
					       I set a custom LEDGER_FILE, but hledger is still using the default file
 | 
				
			||||||
       LEDGER_FILE  should  be  a  real environment variable, not just a shell
 | 
					       LEDGER_FILE should be a real environment variable,  not  just  a  shell
 | 
				
			||||||
       variable.  The command env | grep LEDGER_FILE should show it.  You  may
 | 
					       variable.   The command env | grep LEDGER_FILE should show it.  You may
 | 
				
			||||||
       need to use export.  Here's an explanation.
 | 
					       need to use export.  Here's an explanation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       "Illegal  byte  sequence"  or  "Invalid or incomplete multibyte or wide
 | 
					       "Illegal byte sequence" or "Invalid or  incomplete  multibyte  or  wide
 | 
				
			||||||
       character" errors
 | 
					       character" errors
 | 
				
			||||||
       In order to handle non-ascii letters and symbols (like ), hledger needs
 | 
					       In order to handle non-ascii letters and symbols (like ), hledger needs
 | 
				
			||||||
       an appropriate locale.  This is usually configured system-wide; you can
 | 
					       an appropriate locale.  This is usually configured system-wide; you can
 | 
				
			||||||
       also configure it temporarily.  The locale may need to be one that sup-
 | 
					       also configure it temporarily.  The locale may need to be one that sup-
 | 
				
			||||||
       ports  UTF-8,  if you built hledger with GHC < 7.2 (or possibly always,
 | 
					       ports UTF-8, if you built hledger with GHC < 7.2 (or  possibly  always,
 | 
				
			||||||
       I'm not sure yet).
 | 
					       I'm not sure yet).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       Here's  an  example  of  setting  the  locale  temporarily,  on  ubuntu
 | 
					       Here's  an  example  of  setting  the  locale  temporarily,  on  ubuntu
 | 
				
			||||||
@ -2167,7 +2170,7 @@ TROUBLESHOOTING
 | 
				
			|||||||
              $ echo "export LANG=en_US.UTF-8" >>~/.bash_profile
 | 
					              $ echo "export LANG=en_US.UTF-8" >>~/.bash_profile
 | 
				
			||||||
              $ bash --login
 | 
					              $ bash --login
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       If  we  preferred  to  use eg fr_FR.utf8, we might have to install that
 | 
					       If we preferred to use eg fr_FR.utf8, we might  have  to  install  that
 | 
				
			||||||
       first:
 | 
					       first:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              $ apt-get install language-pack-fr
 | 
					              $ apt-get install language-pack-fr
 | 
				
			||||||
@ -2188,7 +2191,7 @@ TROUBLESHOOTING
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
REPORTING BUGS
 | 
					REPORTING BUGS
 | 
				
			||||||
       Report  bugs at http://bugs.hledger.org (or on the #hledger IRC channel
 | 
					       Report bugs at http://bugs.hledger.org (or on the #hledger IRC  channel
 | 
				
			||||||
       or hledger mail list)
 | 
					       or hledger mail list)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -2202,7 +2205,7 @@ COPYRIGHT
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SEE ALSO
 | 
					SEE ALSO
 | 
				
			||||||
       hledger(1),     hledger-ui(1),     hledger-web(1),      hledger-api(1),
 | 
					       hledger(1),      hledger-ui(1),     hledger-web(1),     hledger-api(1),
 | 
				
			||||||
       hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
 | 
					       hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
 | 
				
			||||||
       dot(5), ledger(1)
 | 
					       dot(5), ledger(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -506,7 +506,10 @@ you can alter the report mode with `--change`/`--cumulative`/`--historical`.
 | 
				
			|||||||
This command also supports [output destination](/manual.html#output-destination) and [output format](/manual.html#output-format) selection.
 | 
					This command also supports [output destination](/manual.html#output-destination) and [output format](/manual.html#output-format) selection.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## prices
 | 
					## prices
 | 
				
			||||||
Print all [market prices](/manual#market-prices) from the journal.
 | 
					Print [market price directives](/manual#market-prices) from the journal.
 | 
				
			||||||
 | 
					With --costs, also print synthetic market prices based on [transaction prices](/manual#transaction-prices).
 | 
				
			||||||
 | 
					With --inverted-costs, also print inverse prices based on transaction prices.
 | 
				
			||||||
 | 
					Prices (and postings providing prices) can be filtered by a query.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## print
 | 
					## print
 | 
				
			||||||
Show transactions from the journal. Aliases: p, txns.
 | 
					Show transactions from the journal. Aliases: p, txns.
 | 
				
			||||||
 | 
				
			|||||||
@ -148,15 +148,13 @@ If you prefer more control or if hledger-install failed, here's how to use stack
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    On Windows, the 64-bit version of stack is [preferred](https://github.com/simonmichael/hledger/issues/275#issuecomment-123834252).
 | 
					    On Windows, the 64-bit version of stack is [preferred](https://github.com/simonmichael/hledger/issues/275#issuecomment-123834252).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
2. **`stack install --resolver=nightly-2018-06-02 hledger-lib-1.10 hledger-1.10 hledger-ui-1.10 fsnotify-0.3.0.1 hledger-web-1.10.1 hledger-api-1.10`**\
 | 
					2. **`stack install --resolver=lts-12 hledger-lib-1.10 hledger-1.10 hledger-ui-1.10.1 hledger-web-1.10 hledger-api-1.10`**\
 | 
				
			||||||
    This installs the main hledger packages (and dependencies) from [Stackage](https://www.stackage.org) and/or [Hackage](http://hackage.haskell.org).
 | 
					    This installs the main hledger packages (and dependencies) from [Stackage](https://www.stackage.org) and/or [Hackage](http://hackage.haskell.org).
 | 
				
			||||||
    You can save some time by omitting hledger-* packages you don't want.\
 | 
					    You can save some time by omitting hledger-* packages you don't want.\
 | 
				
			||||||
    <span class=warnings>([windows: hledger-ui is not available](https://github.com/jtdaugherty/vty/pull/1#issuecomment-297143444))</span>
 | 
					    <span class=warnings>([windows: hledger-ui is not available](https://github.com/jtdaugherty/vty/pull/1#issuecomment-297143444))</span>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    The command above uses stackage's nightly snapshot.
 | 
					 | 
				
			||||||
    You might be able to reduce build time by specifying an older snapshot that you've used before (eg: `--resolver=lts-10.8`), or by omitting the --resolver option.
 | 
					 | 
				
			||||||
    To estimate the build time, add `--dry-run`. 
 | 
					 | 
				
			||||||
    You can kill and restart this without losing progress. 
 | 
					    You can kill and restart this without losing progress. 
 | 
				
			||||||
 | 
					    To estimate the build time, add `--dry-run`. 
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    If you see "was generated with a newer version of hpack, please upgrade and try again" errors, you can ignore them.
 | 
					    If you see "was generated with a newer version of hpack, please upgrade and try again" errors, you can ignore them.
 | 
				
			||||||
    (Upgrade to the latest stack release to stop them.)
 | 
					    (Upgrade to the latest stack release to stop them.)
 | 
				
			||||||
@ -179,9 +177,7 @@ If you prefer more control or if hledger-install failed, here's how to use stack
 | 
				
			|||||||
   [hledger-iadd](http://hackage.haskell.org/package/hledger-iadd),
 | 
					   [hledger-iadd](http://hackage.haskell.org/package/hledger-iadd),
 | 
				
			||||||
   [hledger-interest](http://hackage.haskell.org/package/hledger-interest),
 | 
					   [hledger-interest](http://hackage.haskell.org/package/hledger-interest),
 | 
				
			||||||
   and [hledger-irr](http://hackage.haskell.org/package/hledger-irr)
 | 
					   and [hledger-irr](http://hackage.haskell.org/package/hledger-irr)
 | 
				
			||||||
   can be installed similarly to the above. Eg:
 | 
					   can be installed similarly to the above.
 | 
				
			||||||
 | 
					 | 
				
			||||||
    **`stack install --resolver=nightly-2018-06-02 hledger-lib-1.10 hledger-1.10 hledger-iadd-1.3.5`**
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
6. **[Test](#test)**
 | 
					6. **[Test](#test)**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user