This commit is contained in:
Simon Michael 2007-05-01 05:55:35 +00:00
parent 8f64ddf533
commit f5a41220ea
2 changed files with 4 additions and 1 deletions

View File

@ -16,13 +16,15 @@ ledgerFilePath = findFileFromOpts "~/ledger.dat" "LEDGER"
options :: [OptDescr Flag] options :: [OptDescr Flag]
options = [ options = [
Option ['f'] ["file"] (ReqArg File "FILE") "ledger file; - means use standard input", Option ['f'] ["file"] (ReqArg File "FILE") "ledger file; - means use standard input",
Option ['s'] ["showsubs"] (NoArg ShowSubs) "balance report: show subaccounts" -- register: show subtotals Option ['s'] ["showsubs"] (NoArg ShowSubs) "balance report: show subaccounts", -- register: show subtotals
Option ['h'] ["help"] (NoArg Help) "show this help"
--Option ['V'] ["version"] (NoArg Version) "show version" --Option ['V'] ["version"] (NoArg Version) "show version"
] ]
data Flag = data Flag =
File String | File String |
ShowSubs | ShowSubs |
Help |
Version Version
deriving (Show,Eq) deriving (Show,Eq)

View File

@ -43,6 +43,7 @@ main = do
let (acctpats, descpats) = parseLedgerPatternArgs args let (acctpats, descpats) = parseLedgerPatternArgs args
run cmd opts acctpats descpats run cmd opts acctpats descpats
where run cmd opts acctpats descpats where run cmd opts acctpats descpats
| Help `elem` opts = putStr usage
| cmd `isPrefixOf` "register" = register opts acctpats descpats | cmd `isPrefixOf` "register" = register opts acctpats descpats
| cmd `isPrefixOf` "balance" = balance opts acctpats descpats | cmd `isPrefixOf` "balance" = balance opts acctpats descpats
| cmd `isPrefixOf` "test" = selftest | cmd `isPrefixOf` "test" = selftest