;lib: clean out showTransactionUnelided
Keep aliases until next major release.
This commit is contained in:
parent
aca214b0ac
commit
ab9c150759
@ -38,7 +38,7 @@ main = do
|
|||||||
q = queryFromOpts d ropts
|
q = queryFromOpts d ropts
|
||||||
ts = filter (q `matchesTransaction`) $ jtxns $ journalSelectingAmountFromOpts ropts j
|
ts = filter (q `matchesTransaction`) $ jtxns $ journalSelectingAmountFromOpts ropts j
|
||||||
ts' = map transactionSwapDates ts
|
ts' = map transactionSwapDates ts
|
||||||
mapM_ (putStrLn . showTransactionUnelided) ts'
|
mapM_ (putStrLn . showTransaction) ts'
|
||||||
|
|
||||||
transactionSwapDates :: Transaction -> Transaction
|
transactionSwapDates :: Transaction -> Transaction
|
||||||
transactionSwapDates t@Transaction{tdate2=Nothing} = t
|
transactionSwapDates t@Transaction{tdate2=Nothing} = t
|
||||||
|
|||||||
@ -62,7 +62,7 @@ tsDraw UIState{aopts=UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}
|
|||||||
where
|
where
|
||||||
maincontent = Widget Greedy Greedy $ do
|
maincontent = Widget Greedy Greedy $ do
|
||||||
render $ defaultLayout toplabel bottomlabel $ str $
|
render $ defaultLayout toplabel bottomlabel $ str $
|
||||||
showTransactionUnelidedOneLineAmounts $
|
showTransactionOneLineAmounts $
|
||||||
-- (if real_ ropts then filterTransactionPostings (Real True) else id) -- filter postings by --real
|
-- (if real_ ropts then filterTransactionPostings (Real True) else id) -- filter postings by --real
|
||||||
t
|
t
|
||||||
where
|
where
|
||||||
|
|||||||
@ -371,7 +371,7 @@ showDefault s = " [" ++ s ++ "]"
|
|||||||
journalAddTransaction :: Journal -> CliOpts -> Transaction -> IO Journal
|
journalAddTransaction :: Journal -> CliOpts -> Transaction -> IO Journal
|
||||||
journalAddTransaction j@Journal{jtxns=ts} opts t = do
|
journalAddTransaction j@Journal{jtxns=ts} opts t = do
|
||||||
let f = journalFilePath j
|
let f = journalFilePath j
|
||||||
appendToJournalFileOrStdout f $ showTransactionUnelided t
|
appendToJournalFileOrStdout f $ showTransaction t
|
||||||
-- unelided shows all amounts explicitly, in case there's a price, cf #283
|
-- unelided shows all amounts explicitly, in case there's a price, cf #283
|
||||||
when (debug_ opts > 0) $ do
|
when (debug_ opts > 0) $ do
|
||||||
putStrLn $ printf "\nAdded transaction to %s:" f
|
putStrLn $ printf "\nAdded transaction to %s:" f
|
||||||
|
|||||||
@ -45,7 +45,7 @@ checkdates CliOpts{rawopts_=rawopts,reportopts_=ropts} j = do
|
|||||||
(show $ date previous)
|
(show $ date previous)
|
||||||
(show $ date error)
|
(show $ date error)
|
||||||
(show $ tsourcepos error)
|
(show $ tsourcepos error)
|
||||||
(showTransactionUnelided error)
|
(showTransaction error)
|
||||||
|
|
||||||
data FoldAcc a b = FoldAcc
|
data FoldAcc a b = FoldAcc
|
||||||
{ fa_error :: Maybe a
|
{ fa_error :: Maybe a
|
||||||
|
|||||||
@ -21,7 +21,6 @@ closemode = hledgerCommandMode
|
|||||||
$(embedFileRelative "Hledger/Cli/Commands/Close.txt")
|
$(embedFileRelative "Hledger/Cli/Commands/Close.txt")
|
||||||
[flagNone ["opening"] (setboolopt "opening") "show just opening transaction"
|
[flagNone ["opening"] (setboolopt "opening") "show just opening transaction"
|
||||||
,flagNone ["closing"] (setboolopt "closing") "show just closing transaction"
|
,flagNone ["closing"] (setboolopt "closing") "show just closing transaction"
|
||||||
-- ,flagNone ["explicit","x"] (setboolopt "explicit") "show all amounts explicitly"
|
|
||||||
]
|
]
|
||||||
[generalflagsgroup1]
|
[generalflagsgroup1]
|
||||||
hiddenflags
|
hiddenflags
|
||||||
@ -88,12 +87,6 @@ close CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
-- With -x, show all amounts explicitly (ie, also in the balancing equity posting(s)).
|
when closing $ putStr $ showTransaction (nulltransaction{tdate=closingdate, tdescription="closing balances", tpostings=closingps})
|
||||||
-- print also does it for -B; I think that isn't needed here.
|
when opening $ putStr $ showTransaction (nulltransaction{tdate=openingdate, tdescription="opening balances", tpostings=openingps})
|
||||||
-- showtxn | boolopt "explicit" rawopts = showTransactionUnelided
|
|
||||||
-- | otherwise = showTransaction
|
|
||||||
showtxn = showTransactionUnelided
|
|
||||||
|
|
||||||
when closing $ putStr $ showtxn (nulltransaction{tdate=closingdate, tdescription="closing balances", tpostings=closingps})
|
|
||||||
when opening $ putStr $ showtxn (nulltransaction{tdate=openingdate, tdescription="opening balances", tpostings=openingps})
|
|
||||||
|
|
||||||
|
|||||||
@ -50,7 +50,7 @@ importcmd opts@CliOpts{rawopts_=rawopts,inputopts_=iopts} j = do
|
|||||||
printf "; would import %d new transactions from %s:\n\n" (length newts) inputstr
|
printf "; would import %d new transactions from %s:\n\n" (length newts) inputstr
|
||||||
-- TODO how to force output here ?
|
-- TODO how to force output here ?
|
||||||
-- length (jtxns newj) `seq` print' opts{rawopts_=("explicit",""):rawopts} newj
|
-- length (jtxns newj) `seq` print' opts{rawopts_=("explicit",""):rawopts} newj
|
||||||
mapM_ (putStr . showTransactionUnelided) newts
|
mapM_ (putStr . showTransaction) newts
|
||||||
newts | catchup -> do
|
newts | catchup -> do
|
||||||
printf "marked %s as caught up, skipping %d unimported transactions\n\n" inputstr (length newts)
|
printf "marked %s as caught up, skipping %d unimported transactions\n\n" inputstr (length newts)
|
||||||
newts -> do
|
newts -> do
|
||||||
|
|||||||
@ -59,7 +59,7 @@ printEntries opts@CliOpts{reportopts_=ropts} j = do
|
|||||||
writeOutput opts $ render $ entriesReport ropts' q j
|
writeOutput opts $ render $ entriesReport ropts' q j
|
||||||
|
|
||||||
entriesReportAsText :: CliOpts -> EntriesReport -> String
|
entriesReportAsText :: CliOpts -> EntriesReport -> String
|
||||||
entriesReportAsText opts = concatMap (showTransactionUnelided . gettxn)
|
entriesReportAsText opts = concatMap (showTransaction . gettxn)
|
||||||
where
|
where
|
||||||
gettxn | useexplicittxn = id -- use fully inferred amounts & txn prices
|
gettxn | useexplicittxn = id -- use fully inferred amounts & txn prices
|
||||||
| otherwise = originalTransaction -- use original as-written amounts/txn prices
|
| otherwise = originalTransaction -- use original as-written amounts/txn prices
|
||||||
@ -162,7 +162,7 @@ printMatch CliOpts{reportopts_=ropts} j desc = do
|
|||||||
let q = queryFromOpts d ropts
|
let q = queryFromOpts d ropts
|
||||||
case similarTransaction' j q desc of
|
case similarTransaction' j q desc of
|
||||||
Nothing -> putStrLn "no matches found."
|
Nothing -> putStrLn "no matches found."
|
||||||
Just t -> putStr $ showTransactionUnelided t
|
Just t -> putStr $ showTransaction t
|
||||||
|
|
||||||
where
|
where
|
||||||
-- Identify the closest recent match for this description in past transactions.
|
-- Identify the closest recent match for this description in past transactions.
|
||||||
|
|||||||
@ -132,7 +132,7 @@ diffTxn j t t' =
|
|||||||
diffs = map mapDiff $ D.getDiff source changed'
|
diffs = map mapDiff $ D.getDiff source changed'
|
||||||
source | Just contents <- lookup fp $ jfiles j = map T.unpack . drop (line-1) . take line' $ T.lines contents
|
source | Just contents <- lookup fp $ jfiles j = map T.unpack . drop (line-1) . take line' $ T.lines contents
|
||||||
| otherwise = []
|
| otherwise = []
|
||||||
changed = lines $ showTransactionUnelided t'
|
changed = lines $ showTransaction t'
|
||||||
changed' | null changed = changed
|
changed' | null changed = changed
|
||||||
| null $ last changed = init changed
|
| null $ last changed = init changed
|
||||||
| otherwise = changed
|
| otherwise = changed
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user