mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 07:09:28 +03:00
ui, web: Enable --pivot and --anon in ui and web (#474)
This commit is contained in:
parent
e8aecb51ee
commit
13a6584440
@ -77,7 +77,11 @@ withJournalDoUICommand uopts@UIOpts{cliopts_=copts} cmd = do
|
|||||||
rulespath <- rulesFilePathFromOpts copts
|
rulespath <- rulesFilePathFromOpts copts
|
||||||
journalpath <- journalFilePathFromOpts copts
|
journalpath <- journalFilePathFromOpts copts
|
||||||
ej <- readJournalFiles Nothing rulespath (not $ ignore_assertions_ copts) journalpath
|
ej <- readJournalFiles Nothing rulespath (not $ ignore_assertions_ copts) journalpath
|
||||||
either error' (cmd uopts . journalApplyAliases (aliasesFromOpts copts)) ej
|
let fn = cmd uopts .
|
||||||
|
pivotByOpts copts .
|
||||||
|
anonymiseByOpts copts .
|
||||||
|
journalApplyAliases (aliasesFromOpts copts)
|
||||||
|
either error' fn ej
|
||||||
|
|
||||||
runBrickUi :: UIOpts -> Journal -> IO ()
|
runBrickUi :: UIOpts -> Journal -> IO ()
|
||||||
runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do
|
runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do
|
||||||
|
@ -51,16 +51,19 @@ runWith opts
|
|||||||
withJournalDo' opts web
|
withJournalDo' opts web
|
||||||
|
|
||||||
withJournalDo' :: WebOpts -> (WebOpts -> Journal -> IO ()) -> IO ()
|
withJournalDo' :: WebOpts -> (WebOpts -> Journal -> IO ()) -> IO ()
|
||||||
withJournalDo' opts cmd = do
|
withJournalDo' opts@WebOpts {cliopts_ = cliopts} cmd = do
|
||||||
f <- head `fmap` journalFilePathFromOpts (cliopts_ opts) -- XXX head should be safe for now
|
f <- head `fmap` journalFilePathFromOpts cliopts -- XXX head should be safe for now
|
||||||
|
|
||||||
-- https://github.com/simonmichael/hledger/issues/202
|
-- https://github.com/simonmichael/hledger/issues/202
|
||||||
-- -f- gives [Error#yesod-core] <stdin>: hGetContents: illegal operation (handle is closed) for some reason
|
-- -f- gives [Error#yesod-core] <stdin>: hGetContents: illegal operation (handle is closed) for some reason
|
||||||
-- 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"
|
||||||
|
|
||||||
readJournalFile Nothing Nothing True f >>=
|
let fn = cmd opts .
|
||||||
either error' (cmd opts . journalApplyAliases (aliasesFromOpts $ cliopts_ opts))
|
pivotByOpts cliopts .
|
||||||
|
anonymiseByOpts cliopts .
|
||||||
|
journalApplyAliases (aliasesFromOpts cliopts)
|
||||||
|
readJournalFile Nothing Nothing True f >>= either error' fn
|
||||||
|
|
||||||
-- | The web command.
|
-- | The web command.
|
||||||
web :: WebOpts -> Journal -> IO ()
|
web :: WebOpts -> Journal -> IO ()
|
||||||
|
@ -19,6 +19,8 @@ module Hledger.Cli.Utils
|
|||||||
writeFileWithBackup,
|
writeFileWithBackup,
|
||||||
writeFileWithBackupIfChanged,
|
writeFileWithBackupIfChanged,
|
||||||
readFileStrictly,
|
readFileStrictly,
|
||||||
|
pivotByOpts,
|
||||||
|
anonymiseByOpts,
|
||||||
Test(TestList),
|
Test(TestList),
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
Loading…
Reference in New Issue
Block a user