pass index file to gallery/rss

(instead of trying to escape the strings inside in make & on the command
line)
This commit is contained in:
Rhiannon Morris 2020-08-04 02:25:59 +02:00
parent 161cb48d3a
commit 28fc9db3e0
6 changed files with 63 additions and 67 deletions

View file

@ -20,8 +20,7 @@ data ModeOptions =
| GalleryPage {
files :: [FilePath],
prefix :: FilePath,
nsfw :: Bool,
title :: Text,
index :: FilePath,
output :: Maybe FilePath,
dataDir :: FilePath
}
@ -31,9 +30,8 @@ data ModeOptions =
}
| RSS {
files :: [FilePath],
title :: Text,
desc :: Text,
root :: Text,
index :: FilePath,
prefix :: FilePath,
output :: Maybe FilePath,
dataDir :: FilePath
@ -92,27 +90,21 @@ optionsParser = globalOpts `info` mainInfo where
gallery = command "gallery" $ galleryOpts `info` galleryInfo
galleryOpts =
GalleryPage <$> files <*> prefix <*> nsfwG <*> title <*> output <*> dataDir
GalleryPage <$> files <*> prefix <*> indexFile <*> output <*> dataDir
prefix = strOption $
short 'p' <> long "prefix" <> metavar "DIR" <>
value "" <>
help "output directory prefix"
indexFile = strOption $
short 'i' <> long "index" <> metavar "FILE" <>
help "path to index file"
files = many $ strArgument $
metavar "FILE..." <> help "yaml files to read"
nsfwG = switch $
short 'n' <> long "nsfw" <>
help "nsfw versions are included"
title = strOption $
short 't' <> long "title" <> metavar "TITLE" <>
help "page title"
galleryInfo = progDesc "generate a gallery page"
rss = command "rss" $ rssOpts `info` rssInfo
rssOpts = RSS <$> files <*> title <*> desc <*> root
rssOpts = RSS <$> files <*> root <*> indexFile
<*> prefix <*> output <*> dataDir
desc = strOption $
short 'd' <> long "desc" <> metavar "DESC" <>
help "gallery description"
root = strOption $
short 'R' <> long "root" <> metavar "URL" <>
help "website root (no trailing slash)"