lib: mark ledger reader as experimental, don't use automatically

This commit is contained in:
Simon Michael 2016-11-20 10:42:12 -08:00
parent 98ef8f9a60
commit 1f2276c100
7 changed files with 9 additions and 1 deletions

View File

@ -332,6 +332,8 @@ data Reader = Reader {
-- or error message. -- or error message.
,rParser :: Maybe FilePath -> Bool -> FilePath -> Text -> ExceptT String IO Journal ,rParser :: Maybe FilePath -> Bool -> FilePath -> Text -> ExceptT String IO Journal
-- Experimental readers are never tried automatically.
,rExperimental :: Bool
} }
instance Show Reader where show r = rFormat r ++ " reader" instance Show Reader where show r = rFormat r ++ " reader"

View File

@ -214,7 +214,8 @@ tests_readJournal' = [
readJournal :: Maybe StorageFormat -> Maybe FilePath -> Bool -> Maybe FilePath -> Text -> IO (Either String Journal) readJournal :: Maybe StorageFormat -> Maybe FilePath -> Bool -> Maybe FilePath -> Text -> IO (Either String Journal)
readJournal mformat mrulesfile assrt mfile txt = readJournal mformat mrulesfile assrt mfile txt =
let let
rs = maybe readers (:[]) $ findReader mformat mfile stablereaders = filter (not.rExperimental) readers
rs = maybe stablereaders (:[]) $ findReader mformat mfile
in in
tryReaders rs mrulesfile assrt mfile txt tryReaders rs mrulesfile assrt mfile txt

View File

@ -68,6 +68,7 @@ reader = Reader
{rFormat = "csv" {rFormat = "csv"
,rExtensions = ["csv"] ,rExtensions = ["csv"]
,rParser = parse ,rParser = parse
,rExperimental = False
} }
-- | Parse and post-process a "Journal" from CSV data, or give an error. -- | Parse and post-process a "Journal" from CSV data, or give an error.

View File

@ -110,6 +110,7 @@ reader = Reader
{rFormat = "journal" {rFormat = "journal"
,rExtensions = ["journal", "j", "hledger", "ledger"] ,rExtensions = ["journal", "j", "hledger", "ledger"]
,rParser = parse ,rParser = parse
,rExperimental = False
} }
-- | Parse and post-process a "Journal" from hledger's journal file -- | Parse and post-process a "Journal" from hledger's journal file

View File

@ -46,6 +46,7 @@ reader = Reader
{rFormat = "ledger" {rFormat = "ledger"
,rExtensions = [] ,rExtensions = []
,rParser = parse ,rParser = parse
,rExperimental = True
} }
-- | Generate an action that parses and post-processes a "Journal" from a -- | Generate an action that parses and post-processes a "Journal" from a

View File

@ -73,6 +73,7 @@ reader = Reader
{rFormat = "timeclock" {rFormat = "timeclock"
,rExtensions = ["timeclock"] ,rExtensions = ["timeclock"]
,rParser = parse ,rParser = parse
,rExperimental = False
} }
-- | Parse and post-process a "Journal" from timeclock.el's timeclock -- | Parse and post-process a "Journal" from timeclock.el's timeclock

View File

@ -58,6 +58,7 @@ reader = Reader
{rFormat = "timedot" {rFormat = "timedot"
,rExtensions = ["timedot"] ,rExtensions = ["timedot"]
,rParser = parse ,rParser = parse
,rExperimental = False
} }
-- | Parse and post-process a "Journal" from the timedot format, or give an error. -- | Parse and post-process a "Journal" from the timedot format, or give an error.