Ignore assertions during add with -I
This commit is contained in:
parent
636860363f
commit
b042115692
@ -155,7 +155,7 @@ transactionCheckAssertions bopts j t =
|
||||
if (ignore_assertions_ bopts) || noassertions t then Right t else do
|
||||
j' <- journalStyleAmounts j
|
||||
let newtxns = sortOn tdate (jtxns j' ++ [ t ])
|
||||
case journalBalanceTransactions defbalancingopts j'{jtxns = newtxns} of
|
||||
case journalBalanceTransactions bopts j'{jtxns = newtxns} of
|
||||
Right _ -> Right t
|
||||
Left e -> Left e
|
||||
where
|
||||
|
||||
@ -248,7 +248,8 @@ confirmedTransactionWizard prevInput es@EntryState{..} stack@(currentStage : _)
|
||||
dummytxn = nulltransaction{tpostings = esPostings ++ [p, post "" missingamt]
|
||||
,tdate = txnDate txnParams
|
||||
,tdescription = txnDesc txnParams }
|
||||
validated = balanceTransaction defbalancingopts dummytxn >>= transactionCheckAssertions defbalancingopts esJournal
|
||||
bopts = balancingopts_ (inputopts_ esOpts)
|
||||
validated = balanceTransaction bopts dummytxn >>= transactionCheckAssertions bopts esJournal
|
||||
case validated of
|
||||
Left err -> do
|
||||
liftIO (hPutStrLn stderr err)
|
||||
|
||||
@ -220,8 +220,20 @@ $ rm -f nosuch.journal; hledger -f nosuch.journal add; rm -f nosuch.journal
|
||||
> /\(a\)[[:space:]]+3 = 3 ; date:2025-05-01/
|
||||
>2 //
|
||||
|
||||
## 16. Verify that -I skips assertions
|
||||
<
|
||||
2025-05-10
|
||||
x
|
||||
a
|
||||
10 USD = 20 USD
|
||||
b
|
||||
-10 USD
|
||||
.
|
||||
$ rm -f nosuch.journal; hledger -f nosuch.journal -I add; rm -f nosuch.journal
|
||||
> /Save this transaction to the journal/
|
||||
>2 //
|
||||
|
||||
## 16. shouldn't add decimals if there aren't any
|
||||
## 17. shouldn't add decimals if there aren't any
|
||||
## printf '\n\na\n1\nb\n' | hledger -f /dev/null add
|
||||
# <
|
||||
#
|
||||
|
||||
Loading…
Reference in New Issue
Block a user