From 2b68087b231940ad47e3e2f1a465a66c6c655f22 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Thu, 8 Jun 2023 20:54:07 +0200 Subject: source multiple directories at once --- Types.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Types.hs') diff --git a/Types.hs b/Types.hs index a6a8b2b..12977d8 100644 --- a/Types.hs +++ b/Types.hs @@ -6,6 +6,7 @@ module Types where import Control.Monad.Trans.State.Lazy +import Data.List.NonEmpty import qualified Data.Map as M import qualified Data.Set as S import qualified Data.Yaml as Y @@ -44,7 +45,7 @@ data SiteState = , _templates :: M.Map FilePath Mu.Template , _outputDir :: FilePath -- ^ Directory for output , _assetDir :: FilePath -- ^ Directory for output - , _sourceDir :: FilePath -- ^ Path to page source data + , _sourceDirs :: [FilePath] -- ^ Path to page source data , _templateDir :: FilePath -- ^ Path to template directory , _defaultTemplate :: FilePath -- ^ Name of the default template , _redirectTemplate :: FilePath -- ^ Name of the template for redirect pages @@ -73,12 +74,12 @@ siteOptions' = do short 'a' <> help "Assets directory to be copied verbatim" <> value "assets" <> showDefault - _sourceDir <- - strOption $ + _sourceDirs <- + fmap (maybe ["cards"] toList . nonEmpty) . many . strOption $ long "source-directory" <> short 's' <> - help "Path to the directory with source data (possibly multiple paths)" <> - value "cards" <> showDefault + help + "Path to the directory with source data (possibly multiple paths, defaults to a single directory \"cards\")" _templateDir <- strOption $ long "template-directory" <> -- cgit v1.2.3