diff options
Diffstat (limited to 'src/Text/Pandoc/App/CommandLineOptions.hs')
-rw-r--r-- | src/Text/Pandoc/App/CommandLineOptions.hs | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs index 18d15843e..2a4942841 100644 --- a/src/Text/Pandoc/App/CommandLineOptions.hs +++ b/src/Text/Pandoc/App/CommandLineOptions.hs @@ -50,7 +50,7 @@ import Text.Pandoc import Text.Pandoc.App.Opt (Opt (..), LineEnding (..), IpynbOutput (..), addMeta) import Text.Pandoc.Filter (Filter (..)) import Text.Pandoc.Highlighting (highlightingStyles) -import Text.Pandoc.Shared (ordNub, elemText, safeStrRead, defaultUserDataDirs) +import Text.Pandoc.Shared (ordNub, elemText, safeStrRead, defaultUserDataDirs, findM) import Text.Printf #ifdef EMBED_DATA_FILES @@ -118,14 +118,6 @@ engines = map ("html",) htmlEngines ++ pdfEngines :: [String] pdfEngines = ordNub $ map snd engines -findFile :: PandocMonad m => [FilePath] -> m (Maybe FilePath) -findFile [] = return Nothing -findFile (f:fs) = do - exists <- fileExists f - if exists - then return $ Just f - else findFile fs - -- | A list of functions, each transforming the options data structure -- in response to a command-line option. options :: [OptDescr (Opt -> IO Opt)] @@ -996,7 +988,7 @@ applyDefaults opt file = runIOorExplode $ do Nothing -> map (</> ("defaults" </> fp)) dataDirs Just dd -> [dd </> "defaults" </> fp] - fp' <- fromMaybe fp <$> findFile fps + fp' <- fromMaybe fp <$> findM fileExists fps inp <- readFileLazy fp' case Y.decode1 inp of Right (f :: Opt -> Opt) -> return $ f opt |