dev: include: cleanup

This commit is contained in:
Simon Michael 2025-07-15 10:50:34 -07:00
parent 3741f9f030
commit 8215f19baa
3 changed files with 5 additions and 4 deletions

View File

@ -71,7 +71,6 @@ module Hledger.Read.JournalReader (
where
--- ** imports
import qualified Control.Monad.Fail as Fail (fail)
import qualified Control.Exception as C
import Control.Monad (forM_, when, void, unless, filterM)
import Control.Monad.IO.Class (MonadIO, liftIO)
@ -387,10 +386,10 @@ includedirectivep = do
g <- case tryCompileWith compDefault{errorRecovery=False} expandedglob of
Left e ->
customFailure $ parseErrorAt off $ "Invalid glob pattern: " ++ e
Right _ | regexMatch (toRegex' "\\*\\*[^/]") expandedglob ->
customFailure $ parseErrorAt off $ "Invalid glob pattern: double star requires slash, use * or **/"
Right _ | "***" `isInfixOf` expandedglob ->
customFailure $ parseErrorAt off $ "Invalid glob pattern: too many stars, use * or **/"
Right _ | regexMatch (toRegex' "\\*\\*[^/]") expandedglob ->
customFailure $ parseErrorAt off $ "Invalid glob pattern: double star requires slash, use **/"
Right x -> pure x
let isglob = not $ isLiteral g
@ -507,7 +506,7 @@ orRethrowIOError io msg = do
eResult <- liftIO $ (Right <$> io) `C.catch` \(e::C.IOException) -> pure $ Left $ printf "%s:\n%s" msg (show e)
case eResult of
Right res -> pure res
Left errMsg -> Fail.fail errMsg
Left errMsg -> fail errMsg
-- Parse an account directive, adding its info to the journal's
-- list of account declarations.

View File

@ -0,0 +1 @@
include */*.j

View File

@ -0,0 +1 @@
include selfg*.j