lib: also recognise *.hledger as hledger journal format

This commit is contained in:
Simon Michael 2016-11-12 13:55:37 -08:00
parent c8650e0d10
commit 2996ec971b

View File

@ -114,8 +114,8 @@ format = "journal"
-- | Does the given file path and data look like it might be hledger's journal format ? -- | Does the given file path and data look like it might be hledger's journal format ?
detect :: FilePath -> Text -> Bool detect :: FilePath -> Text -> Bool
detect f _t detect f _t
| f /= "-" = takeExtension f `elem` ['.':format, ".j"] -- from a known file name: yes if the extension is this format's name or .j | f /= "-" = takeExtension f `elem` ['.':format, ".j", ".hledger"] -- from a known file name: yes if the extension is .hledger or .journal or .j
| otherwise = True -- from stdin: yes, always attempt to parse stdin as journal data | otherwise = True -- from stdin: yes, always attempt to parse stdin as hledger journal data
-- otherwise = regexMatches "(^|\n)[0-9]+.*\n[ \t]+" $ T.unpack t -- from stdin: yes if we can see something that looks like a journal entry (digits in column 0 with the next line indented) -- otherwise = regexMatches "(^|\n)[0-9]+.*\n[ \t]+" $ T.unpack t -- from stdin: yes if we can see something that looks like a journal entry (digits in column 0 with the next line indented)
-- | Parse and post-process a "Journal" from hledger's journal file -- | Parse and post-process a "Journal" from hledger's journal file