mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-26 03:42:25 +03:00
ui, web: use/support new -V, --forecast, --auto
This commit is contained in:
parent
69e255cead
commit
f8e781462d
@ -71,15 +71,18 @@ main = do
|
|||||||
| "binary-filename" `inRawOpts` (rawopts_ $ cliopts_ opts) = putStrLn (binaryfilename progname)
|
| "binary-filename" `inRawOpts` (rawopts_ $ cliopts_ opts) = putStrLn (binaryfilename progname)
|
||||||
| otherwise = withJournalDoUICommand opts runBrickUi
|
| otherwise = withJournalDoUICommand opts runBrickUi
|
||||||
|
|
||||||
-- XXX withJournalDo specialised for UIOpts
|
-- TODO fix nasty duplication of withJournalDo
|
||||||
withJournalDoUICommand :: UIOpts -> (UIOpts -> Journal -> IO ()) -> IO ()
|
withJournalDoUICommand :: UIOpts -> (UIOpts -> Journal -> IO ()) -> IO ()
|
||||||
withJournalDoUICommand uopts@UIOpts{cliopts_=copts} cmd = do
|
withJournalDoUICommand uopts@UIOpts{cliopts_=copts} cmd = do
|
||||||
journalpath <- journalFilePathFromOpts copts
|
journalpath <- journalFilePathFromOpts copts
|
||||||
ej <- readJournalFilesWithOpts (inputopts_ copts) journalpath
|
ej <- readJournalFilesWithOpts (inputopts_ copts) journalpath
|
||||||
let fn = cmd uopts .
|
let fn = cmd uopts
|
||||||
pivotByOpts copts .
|
. pivotByOpts copts
|
||||||
anonymiseByOpts copts .
|
. anonymiseByOpts copts
|
||||||
journalApplyAliases (aliasesFromOpts copts)
|
. journalApplyAliases (aliasesFromOpts copts)
|
||||||
|
<=< journalApplyValue (reportopts_ copts)
|
||||||
|
<=< journalAddForecast copts
|
||||||
|
. generateAutomaticPostings (reportopts_ copts)
|
||||||
either error' fn ej
|
either error' fn ej
|
||||||
|
|
||||||
runBrickUi :: UIOpts -> Journal -> IO ()
|
runBrickUi :: UIOpts -> Journal -> IO ()
|
||||||
|
@ -22,7 +22,7 @@ import Network.Wai.Handler.Launch (runHostPortUrl)
|
|||||||
#if !MIN_VERSION_base(4,8,0)
|
#if !MIN_VERSION_base(4,8,0)
|
||||||
import Control.Applicative ((<$>))
|
import Control.Applicative ((<$>))
|
||||||
#endif
|
#endif
|
||||||
import Control.Monad (when)
|
import Control.Monad
|
||||||
import Data.Text (pack)
|
import Data.Text (pack)
|
||||||
import System.Exit (exitSuccess)
|
import System.Exit (exitSuccess)
|
||||||
import System.IO (hFlush, stdout)
|
import System.IO (hFlush, stdout)
|
||||||
@ -59,10 +59,13 @@ withJournalDo' opts@WebOpts {cliopts_ = cliopts} cmd = do
|
|||||||
-- Also we may be writing to this file. Just disallow it.
|
-- Also we may be writing to this file. Just disallow it.
|
||||||
when (f == "-") $ error' "hledger-web doesn't support -f -, please specify a file path"
|
when (f == "-") $ error' "hledger-web doesn't support -f -, please specify a file path"
|
||||||
|
|
||||||
let fn = cmd opts .
|
let fn = cmd opts
|
||||||
pivotByOpts cliopts .
|
. pivotByOpts cliopts
|
||||||
anonymiseByOpts cliopts .
|
. anonymiseByOpts cliopts
|
||||||
journalApplyAliases (aliasesFromOpts cliopts)
|
. journalApplyAliases (aliasesFromOpts cliopts)
|
||||||
|
<=< journalApplyValue (reportopts_ cliopts)
|
||||||
|
<=< journalAddForecast cliopts
|
||||||
|
. generateAutomaticPostings (reportopts_ cliopts)
|
||||||
readJournalFile Nothing Nothing True f >>= either error' fn
|
readJournalFile Nothing Nothing True f >>= either error' fn
|
||||||
|
|
||||||
-- | The web command.
|
-- | The web command.
|
||||||
|
Loading…
Reference in New Issue
Block a user