add index page

This commit is contained in:
Rhiannon Morris 2020-07-16 16:29:32 +02:00
parent 375c6e833a
commit 3f025721c8
6 changed files with 63 additions and 8 deletions

View file

@ -22,6 +22,10 @@ data ModeOptions =
output :: Maybe FilePath,
dataDir :: FilePath
}
| IndexPage {
file :: FilePath,
output :: Maybe FilePath
}
| DependSingle {
file :: FilePath,
nsfw :: Bool,
@ -48,7 +52,7 @@ optionsParser = globalOpts `info` mainInfo where
short 'v' <> long "verbose" <>
help "print extra stuff to stderr"
subcommands = hsubparser $
single <> gallery <> dependSingle <> dependGallery
single <> gallery <> index <> dependSingle <> dependGallery
single = command "single" $ singleOpts `info` singleInfo
singleOpts = SinglePage <$> file <*> nsfwS <*> output
@ -63,6 +67,10 @@ optionsParser = globalOpts `info` mainInfo where
help "output file (default: stdout)"
singleInfo = progDesc "generate a page for a single work"
index = command "index" $ indexOpts `info` indexInfo
indexOpts = IndexPage <$> file <*> output
indexInfo = progDesc "generate an index page for all galleries"
gallery = command "gallery" $ galleryOpts `info` galleryInfo
galleryOpts = GalleryPage <$> files <*> title <*> output <*> dataDir
files = many $ strArgument $