be nice and use metavars in --help

This commit is contained in:
Mirek Kratochvil 2025-01-29 20:48:41 +01:00
parent eeb49be54a
commit 540055fb74

View file

@ -88,6 +88,7 @@ siteOptions' = do
strOption strOption
$ long "output" $ long "output"
<> short 'd' <> short 'd'
<> metavar "OUTDIR"
<> help "Directory to render the site to" <> help "Directory to render the site to"
<> value "_site" <> value "_site"
<> showDefault <> showDefault
@ -95,28 +96,33 @@ siteOptions' = do
Just Just
<$> (strOption <$> (strOption
$ long "search-data-output" $ long "search-data-output"
<> metavar "JSON"
<> help "Output JSON with searchable page data to this file") <> help "Output JSON with searchable page data to this file")
<|> pure Nothing <|> pure Nothing
_assetDirs <- _assetDirs <-
many . strOption many . strOption
$ long "assets" $ long "assets"
<> short 'a' <> short 'a'
<> metavar "DIR"
<> help <> help
"Assets directory to be copied verbatim (possibly multiple paths)" "Assets directory to be copied verbatim (possibly multiple paths)"
_sourceDirs <- _sourceDirs <-
many . strOption many . strOption
$ long "source-directory" $ long "source-directory"
<> short 's' <> short 's'
<> metavar "DIR"
<> help <> help
"Path to the directory with source data (possibly multiple paths)" "Path to the directory with source data (possibly multiple paths)"
_notSourceDirs <- _notSourceDirs <-
many . strOption many . strOption
$ long "exclude-source-directory" $ long "exclude-source-directory"
<> metavar "EXCLUDE"
<> help <> help
"Names of subdirectories of the sources that should never be used for sourcing pages (possibly multiple directory names)" "Names of subdirectories of the sources that should never be used for sourcing pages (possibly multiple directory names)"
_tagMetaFile <- _tagMetaFile <-
strOption strOption
$ long "tag-metadata-file" $ long "tag-metadata-file"
<> metavar "FILENAME"
<> help "Name of files with tag metadata" <> help "Name of files with tag metadata"
<> value "tag-metadata.yml" <> value "tag-metadata.yml"
<> showDefault <> showDefault
@ -124,11 +130,13 @@ siteOptions' = do
many . strOption many . strOption
$ long "template-directory" $ long "template-directory"
<> short 't' <> short 't'
<> metavar "DIR"
<> help <> help
"Path to the directory with templates (possibly multiple paths)" "Path to the directory with templates (possibly multiple paths)"
_defaultTemplate <- _defaultTemplate <-
strOption strOption
$ long "default-template" $ long "default-template"
<> metavar "FILENAME"
<> help <> help
"Default template to use for stuff (as found in templates directory)" "Default template to use for stuff (as found in templates directory)"
<> value "default.html" <> value "default.html"
@ -136,24 +144,28 @@ siteOptions' = do
_redirectTemplate <- _redirectTemplate <-
strOption strOption
$ long "redirect-template" $ long "redirect-template"
<> metavar "FILENAME"
<> help "Template for making redirect pages" <> help "Template for making redirect pages"
<> value "redirect.html" <> value "redirect.html"
<> showDefault <> showDefault
_tagTemplate <- _tagTemplate <-
strOption strOption
$ long "tag-template" $ long "tag-template"
<> metavar "FILENAME"
<> help "Template for making category view pages" <> help "Template for making category view pages"
<> value "tag.html" <> value "tag.html"
<> showDefault <> showDefault
_listTemplate <- _listTemplate <-
strOption strOption
$ long "list-template" $ long "list-template"
<> metavar "FILENAME"
<> help "Template for making tag-listing pages" <> help "Template for making tag-listing pages"
<> value "list.html" <> value "list.html"
<> showDefault <> showDefault
_metadataSuffix <- _metadataSuffix <-
strOption strOption
$ long "metadata-suffix" $ long "metadata-suffix"
<> metavar "SUFFIX"
<> help <> help
"Suffix for YAML files with base metadata for each markdown page. Metadata from files override the extra metadata specified on commandline, but are overridden by metadata specified directly in the markdown header of the pages." "Suffix for YAML files with base metadata for each markdown page. Metadata from files override the extra metadata specified on commandline, but are overridden by metadata specified directly in the markdown header of the pages."
<> value ".metadata.yml" <> value ".metadata.yml"
@ -164,11 +176,13 @@ siteOptions' = do
[ fmap MetaSpecInline . strOption [ fmap MetaSpecInline . strOption
$ long "extra-metadata" $ long "extra-metadata"
<> short 'e' <> short 'e'
<> metavar "YAML"
<> help <> help
"Extra metadata to add to pages rendering in YAML format. May be specified multiple times." "Extra metadata to add to pages rendering in YAML format. May be specified multiple times."
, fmap MetaSpecFile . strOption , fmap MetaSpecFile . strOption
$ long "extra-metadata-file" $ long "extra-metadata-file"
<> short 'E' <> short 'E'
<> metavar "FILE"
<> help <> help
"Extra metadata to add to pages rendering, loaded from a YAML file. May be specified multiple times." "Extra metadata to add to pages rendering, loaded from a YAML file. May be specified multiple times."
] ]
@ -176,13 +190,15 @@ siteOptions' = do
strOption strOption
$ long "url-base" $ long "url-base"
<> short 'u' <> short 'u'
<> metavar "URL"
<> help "Base absolute URL" <> help "Base absolute URL"
<> value "/" <> value "/"
<> showDefault <> showDefault
_indexFile <- _indexFile <-
strOption strOption
$ long "index-filename" $ long "index-filename"
<> help "Base absolute URL" <> metavar "FILENAME"
<> help "Directory index to use for page output."
<> value "index.html" <> value "index.html"
<> showDefault <> showDefault
_appendUrlIndex <- _appendUrlIndex <-