implement tag aliases, replacements, warnings

warnings are printed by `list-tags`
This commit is contained in:
rhiannon morris 2024-11-05 00:21:35 +01:00
parent cae6400ec9
commit 67f0c3ded7
9 changed files with 319 additions and 118 deletions

View file

@ -61,8 +61,10 @@ data ModeOptions =
| ListTags {
dataDir :: FilePath,
infoName :: FilePath,
index :: FilePath,
nsfw :: Bool,
listUntagged :: Bool,
showWarnings :: Bool,
sortBy :: TagSort
}
deriving Show
@ -148,14 +150,17 @@ optionsParser = globalOpts `info` mainInfo where
dgInfo = progDesc "generate makefile dependencies for a gallery"
listTags = command "list-tags" $ ltOpts `info` ltInfo
ltOpts = ListTags <$> dataDir <*> infoName <*> nsfwT
<*> listUntagged_ <*> listSort
ltOpts = ListTags <$> dataDir <*> infoName <*> indexFile <*> nsfwT
<*> listUntagged <*> showWarnings <*> listSort
nsfwT = switch $
short 'n' <> long "nsfw" <>
help "include nsfw tags"
listUntagged_ = switch $
listUntagged = switch $
short 'U' <> long "untagged" <>
help "list files with no tags"
showWarnings = switch $
short 'W' <> long "warnings" <>
help "show tag warnings"
listSort = fmap toSort $ switch $
short 'a' <> long "alpha" <>
help "sort alphabetically instead of by frequency"