change command line args for 'gallery'

This commit is contained in:
Rhiannon Morris 2020-07-13 05:00:46 +02:00
parent 1029200b24
commit ca672ddefa

View file

@ -16,10 +16,9 @@ data Options =
copyImages :: Bool
}
| GalleryPage {
directory :: FilePath,
files :: [FilePath],
includeNsfw :: Bool,
output :: Maybe FilePath,
single :: Bool
output :: Maybe FilePath
}
deriving Show
@ -28,14 +27,14 @@ optionsParser =
(Opt.hsubparser (single <> gallery) <**> Opt.helper) `Opt.info` mainInfo
where
single = Opt.command "single" $ singleOpts `Opt.info` singleInfo
singleOpts = SinglePage <$> fileArg <*> nsfwSwitch <*> outputOpt <*> copyOpt
singleOpts = SinglePage <$> fileArg <*> nsfwSwitchS <*> outputOpt <*> copyOpt
fileArg = Opt.strArgument $
Opt.metavar "FILE" <> Opt.help "yaml file to read"
nsfwSwitch = Opt.switch $
nsfwSwitchS = Opt.switch $
Opt.short 'n' <> Opt.long "nsfw" <>
Opt.help "include nsfw versions"
outputOpt = Opt.option (Just <$> Opt.str) $
Opt.short 'o' <> Opt.long "output" <>
Opt.short 'o' <> Opt.long "output" <> Opt.metavar "FILE" <>
Opt.value Nothing <>
Opt.help "output file (default: stdout)"
copyOpt = Opt.switch $
@ -44,13 +43,12 @@ optionsParser =
singleInfo = Opt.progDesc "generate a page for a single work"
gallery = Opt.command "gallery" $ galleryOpts `Opt.info` galleryInfo
galleryOpts =
GalleryPage <$> dirArg <*> nsfwSwitch <*> outputOpt <*> singleOpt
dirArg = Opt.strArgument $
Opt.metavar "DIR" <> Opt.help "directory to search for yaml files"
singleOpt = fmap not $ Opt.switch $
Opt.short 'S' <> Opt.long "exclude-single" <>
Opt.help "do not generate single pages"
galleryOpts = GalleryPage <$> filesArg <*> nsfwSwitchG <*> outputOpt
filesArg = many $ Opt.strArgument $
Opt.metavar "FILE..." <> Opt.help "yaml files to read"
nsfwSwitchG = Opt.switch $
Opt.short 'n' <> Opt.long "nsfw" <>
Opt.help "include works with only nsfw versions"
galleryInfo = Opt.progDesc "generate a gallery page"
mainInfo = Opt.progDesc "static gallery site generator" <> Opt.fullDesc