This commit is contained in:
Simon Michael 2009-04-16 06:33:01 +00:00
parent 1e739d0c1b
commit 2f43748d7d
2 changed files with 25 additions and 2 deletions

24
NOTES
View File

@ -18,6 +18,27 @@ We aim to make reliable, maintainable, usable software, sustainably.
* to do
** errors
*** $ hledger -f new.ledger add
hledger: new.ledger: openFile: does not exist (No such file or directory)
*** runhaskell hledger.hs reg -p 'daily this month' -E
hledger.hs: Prelude.head: empty list
*** joyful> make ci
["/repos/hledger/hledger","web","--debug"] |
*** ghci> readLedger "~/src/hledger/sample.ledger"
Exception: ~/src/hledger/sample.ledger: openFile: does not exist (No such file or directory)
*** not:
hledger: user error (Text.Regex.Posix.String died: (ReturnCode 14,"empty (sub)expression"))
*** histogram stops after last occupied interval
*** hledger: could not balance this transaction, amounts do not add up to zero:
2007/12/08 * bus
expenses:transportation:bus $1.25
assets:cash $-1
assets:coins:quarters $-0.25
** docs/marketing/packaging
*** streamline - less is more
*** automate
@ -30,6 +51,7 @@ We aim to make reliable, maintainable, usable software, sustainably.
***** gmane description
***** darcsweb description
**** keep Options.hs and README option list in sync
**** discover commands for --help
**** accouncements
*** document smart dates, period expressions, display expressions
*** develop funding process
@ -281,6 +303,8 @@ competitors/fellow niche inhabitants
*** graph and reduce dependencies
*** pair programming
** features/wishlist
*** simplify hours again - no default -p, instead alias today="hours -ptoday"
*** allow no command or unordered command with pattern args
*** --flat timelog balance report option for clients
*** alternative easy timelog format
*** better web gui

View File

@ -21,12 +21,11 @@ import qualified Data.Map as Map (lookup)
withLedgerDo :: [Opt] -> [String] -> ([Opt] -> [String] -> Ledger -> IO ()) -> IO ()
withLedgerDo opts args cmd = do
f <- ledgerFilePathFromOpts opts
-- kludgily read the file a second time to get the full text,
-- kludgily read the file a second time to get the full text. Only the ui command needs it.
-- kludgily try not to fail if it's stdin. XXX
rawtext <- readFile $ if f == "-" then "/dev/null" else f
t <- getCurrentLocalTime
let runcmd = cmd opts args . filterAndCacheLedgerWithOpts opts args t rawtext . (\rl -> rl{filepath=f})
return f >>= runErrorT . parseLedgerFile t >>= either (hPutStrLn stderr) runcmd
-- | Get a Ledger from the given string and options, or raise an error.