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