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) | ||||
|         | otherwise                                                = withJournalDoUICommand opts runBrickUi | ||||
| 
 | ||||
| -- XXX withJournalDo specialised for UIOpts | ||||
| -- TODO fix nasty duplication of withJournalDo | ||||
| withJournalDoUICommand :: UIOpts -> (UIOpts -> Journal -> IO ()) -> IO () | ||||
| withJournalDoUICommand uopts@UIOpts{cliopts_=copts} cmd = do | ||||
|   journalpath <- journalFilePathFromOpts copts | ||||
|   ej <- readJournalFilesWithOpts (inputopts_ copts) journalpath | ||||
|   let fn = cmd uopts . | ||||
|            pivotByOpts copts . | ||||
|            anonymiseByOpts copts . | ||||
|            journalApplyAliases (aliasesFromOpts copts) | ||||
|   let fn = cmd uopts | ||||
|          . pivotByOpts copts | ||||
|          . anonymiseByOpts copts | ||||
|          . journalApplyAliases (aliasesFromOpts copts) | ||||
|        <=< journalApplyValue (reportopts_ copts) | ||||
|        <=< journalAddForecast copts | ||||
|          . generateAutomaticPostings (reportopts_ copts) | ||||
|   either error' fn ej | ||||
| 
 | ||||
| runBrickUi :: UIOpts -> Journal -> IO () | ||||
|  | ||||
| @ -22,7 +22,7 @@ import Network.Wai.Handler.Launch (runHostPortUrl) | ||||
| #if !MIN_VERSION_base(4,8,0) | ||||
| import Control.Applicative ((<$>)) | ||||
| #endif | ||||
| import Control.Monad (when) | ||||
| import Control.Monad | ||||
| import Data.Text (pack) | ||||
| import System.Exit (exitSuccess) | ||||
| 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. | ||||
|   when (f == "-") $ error' "hledger-web doesn't support -f -, please specify a file path" | ||||
| 
 | ||||
|   let fn = cmd opts . | ||||
|            pivotByOpts cliopts . | ||||
|            anonymiseByOpts cliopts . | ||||
|            journalApplyAliases (aliasesFromOpts cliopts) | ||||
|   let fn = cmd opts | ||||
|          . pivotByOpts cliopts | ||||
|          . anonymiseByOpts cliopts | ||||
|          . journalApplyAliases (aliasesFromOpts cliopts) | ||||
|        <=< journalApplyValue (reportopts_ cliopts) | ||||
|        <=< journalAddForecast cliopts | ||||
|          . generateAutomaticPostings (reportopts_ cliopts) | ||||
|   readJournalFile Nothing Nothing True f >>= either error' fn | ||||
| 
 | ||||
| -- | The web command. | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user