;bin: script-example: cleanup
This commit is contained in:
parent
39f3b2c7ba
commit
57efcfb79a
@ -62,13 +62,16 @@ cmdmode = hledgerCommandMode (unlines
|
|||||||
[] [generalflagsgroup1] [] ([], Just $ argsFlag "[ARGS]")
|
[] [generalflagsgroup1] [] ([], Just $ argsFlag "[ARGS]")
|
||||||
|
|
||||||
-- Most scripts have three steps:
|
-- Most scripts have three steps:
|
||||||
-- 1. process command line options/arguments
|
|
||||||
-- 2. read the journal file
|
|
||||||
-- 3. do something with it.
|
|
||||||
main = do
|
main = do
|
||||||
|
|
||||||
|
-- 1. process command line options/arguments
|
||||||
opts@CliOpts{reportspec_=rspec} <- getHledgerCliOpts cmdmode
|
opts@CliOpts{reportspec_=rspec} <- getHledgerCliOpts cmdmode
|
||||||
|
|
||||||
|
-- 2. read the journal file
|
||||||
withJournalDo opts $ \j -> do
|
withJournalDo opts $ \j -> do
|
||||||
putStrLn "hello"
|
|
||||||
|
-- 3. do something with it.
|
||||||
|
putStrLn $ (show $ length $ jtxns j) <> " transactions in " <> (show $ journalFilePath j)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user