refactor: move readJournal'
This commit is contained in:
		
							parent
							
								
									197f35cb5b
								
							
						
					
					
						commit
						db4d853a3f
					
				@ -12,6 +12,7 @@ module Hledger.Read (
 | 
			
		||||
       defaultJournalPath,
 | 
			
		||||
       defaultJournal,
 | 
			
		||||
       readJournal,
 | 
			
		||||
       readJournal',
 | 
			
		||||
       readJournalFile,
 | 
			
		||||
       requireJournalFileExists,
 | 
			
		||||
       ensureJournalFileExists,
 | 
			
		||||
@ -89,6 +90,10 @@ readerForFormat s | null rs = Nothing
 | 
			
		||||
    where 
 | 
			
		||||
      rs = filter ((s==).rFormat) readers :: [Reader]
 | 
			
		||||
 | 
			
		||||
-- | Read a journal from the given string, trying all known formats, or simply throw an error.
 | 
			
		||||
readJournal' :: String -> IO Journal
 | 
			
		||||
readJournal' s = readJournal Nothing Nothing Nothing s >>= either error' return
 | 
			
		||||
 | 
			
		||||
-- | Read a Journal from this string or give an error message, using the
 | 
			
		||||
-- specified data format or trying all known formats. A CSV conversion
 | 
			
		||||
-- rules file may be specified for better conversion of that format,
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,6 @@ import Prelude hiding (putStr, putStrLn, appendFile)
 | 
			
		||||
import Hledger.Utils.UTF8IOCompat (putStr, putStrLn, appendFile)
 | 
			
		||||
import Hledger.Cli.Options
 | 
			
		||||
import Hledger.Cli.Register (postingsReportAsText)
 | 
			
		||||
import Hledger.Cli.Utils
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{- | Information used as the basis for suggested account names, amounts,
 | 
			
		||||
 | 
			
		||||
@ -8,7 +8,6 @@ Hledger.Utils.
 | 
			
		||||
module Hledger.Cli.Utils
 | 
			
		||||
    (
 | 
			
		||||
     withJournalDo,
 | 
			
		||||
     readJournal',
 | 
			
		||||
     journalReload,
 | 
			
		||||
     journalReloadIfChanged,
 | 
			
		||||
     journalFileIsNewer,
 | 
			
		||||
@ -55,10 +54,6 @@ withJournalDo opts cmd = do
 | 
			
		||||
-- readJournalWithOpts :: CliOpts -> String -> IO Journal
 | 
			
		||||
-- readJournalWithOpts opts s = readJournal Nothing Nothing Nothing s >>= either error' return
 | 
			
		||||
 | 
			
		||||
-- | Get a journal from the given string, or throw an error.
 | 
			
		||||
readJournal' :: String -> IO Journal
 | 
			
		||||
readJournal' s = readJournal Nothing Nothing Nothing s >>= either error' return
 | 
			
		||||
 | 
			
		||||
-- | Re-read a journal from its data file, or return an error string.
 | 
			
		||||
journalReload :: Journal -> IO (Either String Journal)
 | 
			
		||||
journalReload j = readJournalFile Nothing Nothing $ journalFilePath j
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user