add: command-line args form description of first transaction only
This commit is contained in:
parent
9b8f00b54e
commit
49e66477fb
@ -33,14 +33,15 @@ add opts args l
|
|||||||
|
|
||||||
-- | Read a number of ledger transactions from the command line,
|
-- | Read a number of ledger transactions from the command line,
|
||||||
-- prompting, validating, displaying and appending them to the ledger
|
-- prompting, validating, displaying and appending them to the ledger
|
||||||
-- file, until end of input.
|
-- file, until end of input. Any command-line arguments are used as the
|
||||||
|
-- first transaction's description.
|
||||||
getAndAddTransactions :: Ledger -> [String] -> IO [LedgerTransaction]
|
getAndAddTransactions :: Ledger -> [String] -> IO [LedgerTransaction]
|
||||||
getAndAddTransactions l args = do
|
getAndAddTransactions l args = do
|
||||||
-- for now, thread the eoi flag throughout rather than muck about with monads
|
-- for now, thread the eoi flag throughout rather than muck about with monads
|
||||||
(t, eoi) <- getTransaction l args
|
(t, eoi) <- getTransaction l args
|
||||||
l <- if isJust t then addTransaction l (fromJust t) else return l
|
l <- if isJust t then addTransaction l (fromJust t) else return l
|
||||||
if eoi then return $ maybe [] (:[]) t
|
if eoi then return $ maybe [] (:[]) t
|
||||||
else liftM (fromJust t:) (getAndAddTransactions l args)
|
else liftM (fromJust t:) (getAndAddTransactions l [])
|
||||||
|
|
||||||
-- | Get a transaction from the command line, if possible, and a flag
|
-- | Get a transaction from the command line, if possible, and a flag
|
||||||
-- indicating end of input.
|
-- indicating end of input.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user