resolve conflicts (Make previous entered day a default one)
This commit is contained in:
parent
8274de5e92
commit
3a8906b956
@ -34,14 +34,15 @@ add opts args l
|
|||||||
-- prompting, validating, displaying and appending them to the ledger
|
-- prompting, validating, displaying and appending them to the ledger
|
||||||
-- file, until end of input (then raise an EOF exception). Any
|
-- file, until end of input (then raise an EOF exception). Any
|
||||||
-- command-line arguments are used as the first transaction's description.
|
-- command-line arguments are used as the first transaction's description.
|
||||||
getAndAddTransactions :: Ledger -> [String] -> IO ()
|
getAndAddTransactions :: Ledger -> [Opt] -> [String] -> Day -> IO ()
|
||||||
getAndAddTransactions l args = do
|
getAndAddTransactions l opts args defaultDate = do
|
||||||
l <- getTransaction l args >>= addTransaction l
|
(ledgerTransaction,date) <- getTransaction l opts args defaultDate
|
||||||
getAndAddTransactions l []
|
l <- ledgerAddTransaction l ledgerTransaction
|
||||||
|
getAndAddTransactions l opts args date
|
||||||
|
|
||||||
-- | Read a transaction from the command line, with history-aware prompting.
|
-- | Read a transaction from the command line, with history-aware prompting.
|
||||||
getTransaction :: Ledger -> [String] -> IO LedgerTransaction
|
getTransaction :: Ledger -> [Opt] -> [String] -> Day -> IO (Transaction,Day)
|
||||||
getTransaction l args = do
|
getTransaction l opts args defaultDate = do
|
||||||
today <- getCurrentDay
|
today <- getCurrentDay
|
||||||
datestr <- askFor "date"
|
datestr <- askFor "date"
|
||||||
(Just $ showDate defaultDate)
|
(Just $ showDate defaultDate)
|
||||||
@ -68,7 +69,7 @@ getTransaction l args = do
|
|||||||
retry = do
|
retry = do
|
||||||
hPutStrLn stderr $ "\n" ++ nonzerobalanceerror ++ ". Re-enter:"
|
hPutStrLn stderr $ "\n" ++ nonzerobalanceerror ++ ". Re-enter:"
|
||||||
getpostingsandvalidate
|
getpostingsandvalidate
|
||||||
either (const retry) return $ balanceLedgerTransaction t
|
either (const retry) (return . flip (,) date) $ balanceTransaction t
|
||||||
unless (null historymatches)
|
unless (null historymatches)
|
||||||
(do
|
(do
|
||||||
hPutStrLn stderr "Similar transactions found, using the first for defaults:\n"
|
hPutStrLn stderr "Similar transactions found, using the first for defaults:\n"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user