a lot of stuff sorry
This commit is contained in:
parent
adfc8b9a82
commit
375c6e833a
9 changed files with 297 additions and 151 deletions
|
@ -1,6 +1,6 @@
|
|||
module Options where
|
||||
|
||||
import Info
|
||||
import Data.Text (Text)
|
||||
import Options.Applicative
|
||||
|
||||
data Options =
|
||||
|
@ -17,9 +17,10 @@ data ModeOptions =
|
|||
output :: Maybe FilePath
|
||||
}
|
||||
| GalleryPage {
|
||||
files :: [FilePath],
|
||||
nsfw :: Bool,
|
||||
output :: Maybe FilePath
|
||||
files :: [FilePath],
|
||||
title :: Text,
|
||||
output :: Maybe FilePath,
|
||||
dataDir :: FilePath
|
||||
}
|
||||
| DependSingle {
|
||||
file :: FilePath,
|
||||
|
@ -30,13 +31,12 @@ data ModeOptions =
|
|||
dataDir :: FilePath
|
||||
}
|
||||
| DependGallery {
|
||||
prefix :: FilePath,
|
||||
files :: [FilePath],
|
||||
nsfw :: Bool,
|
||||
who :: Who,
|
||||
file :: FilePath,
|
||||
output :: Maybe FilePath,
|
||||
buildDir :: FilePath,
|
||||
dataDir :: FilePath
|
||||
dataDir :: FilePath,
|
||||
tmpDir :: FilePath,
|
||||
infoName :: FilePath
|
||||
}
|
||||
deriving Show
|
||||
|
||||
|
@ -64,12 +64,12 @@ optionsParser = globalOpts `info` mainInfo where
|
|||
singleInfo = progDesc "generate a page for a single work"
|
||||
|
||||
gallery = command "gallery" $ galleryOpts `info` galleryInfo
|
||||
galleryOpts = GalleryPage <$> files <*> nsfwG <*> output
|
||||
galleryOpts = GalleryPage <$> files <*> title <*> output <*> dataDir
|
||||
files = many $ strArgument $
|
||||
metavar "FILE..." <> help "yaml files to read"
|
||||
nsfwG = switch $
|
||||
short 'n' <> long "nsfw" <>
|
||||
help "include works with no sfw versions"
|
||||
title = strOption $
|
||||
short 't' <> long "title" <> metavar "TITLE" <>
|
||||
help "page title"
|
||||
galleryInfo = progDesc "generate a gallery page"
|
||||
|
||||
dependSingle = command "depend-single" $ dsOpts `info` dsInfo
|
||||
|
@ -81,26 +81,24 @@ optionsParser = globalOpts `info` mainInfo where
|
|||
value "" <>
|
||||
help "output directory prefix"
|
||||
buildDir = strOption $
|
||||
short 'B' <> long "build-dir" <> metavar "DIR" <>
|
||||
value "_build" <>
|
||||
short 'B' <> long "build-dir" <> metavar "DIR" <> value "_build" <>
|
||||
help "build directory (default: _build)"
|
||||
dataDir = strOption $
|
||||
short 'D' <> long "data-dir" <> metavar "DIR" <>
|
||||
value "data" <>
|
||||
short 'D' <> long "data-dir" <> metavar "DIR" <> value "data" <>
|
||||
help "data directory (default: data)"
|
||||
dsInfo = progDesc "generate makefile dependencies for a single page"
|
||||
|
||||
dependGallery = command "depend-gallery" $ dgOpts `info` dgInfo
|
||||
dgOpts =
|
||||
DependGallery <$> prefixArg <*> files <*> nsfwG <*> who
|
||||
<*> output <*> buildDir <*> dataDir
|
||||
prefixArg = strArgument $
|
||||
metavar "PREFIX" <> help "target directory"
|
||||
who = option (maybeReader readWho) $
|
||||
short 'w' <> long "who" <>
|
||||
metavar "mine|not-mine|all" <>
|
||||
value All <>
|
||||
help "select by artist"
|
||||
DependGallery <$> file <*> output
|
||||
<*> buildDir <*> dataDir <*> tmpDir <*> infoName
|
||||
infoName = strOption $
|
||||
short 'I' <> long "info" <> metavar "NAME" <>
|
||||
value "info.yaml" <>
|
||||
help "filename of artwork info files (default: info.yaml)"
|
||||
tmpDir = strOption $
|
||||
short 'T' <> long "tmp-dir" <> metavar "DIR" <> value "_tmp" <>
|
||||
help "temporary directory (default: _tmp)"
|
||||
dgInfo = progDesc "generate makefile dependencies for a gallery"
|
||||
|
||||
mainInfo = progDesc "static gallery site generator" <> fullDesc
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue