Add argument switch to enable RSS generation

This commit is contained in:
Tissevert 2020-03-22 23:16:00 +01:00
parent 36651ddc38
commit 00c9b882b5

View file

@ -6,7 +6,10 @@ module Arguments (
import Data.Monoid ((<>)) import Data.Monoid ((<>))
import Data.Version (showVersion) import Data.Version (showVersion)
import Control.Applicative ((<|>), (<**>), optional) import Control.Applicative ((<|>), (<**>), optional)
import Options.Applicative (Parser, ReadM, argument, auto, eitherReader, execParser, flag', fullDesc, header, help, helper, info, long, metavar, short, str, value) import Options.Applicative (
Parser, ReadM, argument, auto, eitherReader, execParser, flag', fullDesc
, header, help, helper, info, long, metavar, short, str, switch, value
)
import qualified Options.Applicative as Optparse (option) import qualified Options.Applicative as Optparse (option)
import qualified Paths_hablo as Hablo (version) import qualified Paths_hablo as Hablo (version)
import System.FilePath (dropTrailingPathSeparator, isValid) import System.FilePath (dropTrailingPathSeparator, isValid)
@ -24,6 +27,7 @@ data Arguments = BlogConfig {
, previewArticlesCount :: Int , previewArticlesCount :: Int
, previewLinesCount :: Int , previewLinesCount :: Int
, remarkableConfig :: Maybe FilePath , remarkableConfig :: Maybe FilePath
, rss :: Bool
, siteURL :: Maybe String , siteURL :: Maybe String
, wording :: Maybe FilePath , wording :: Maybe FilePath
} }
@ -73,6 +77,11 @@ blogConfig = BlogConfig
) )
<*> option filePath 'r' "remarkable-config" "FILE" <*> option filePath 'r' "remarkable-config" "FILE"
"path to a file containing a custom RemarkableJS configuration" "path to a file containing a custom RemarkableJS configuration"
<*> switch (
short 'R'
<> long "rss"
<> help "enable RSS feeds generation"
)
<*> option filePath 'u' "site-url" "URL" "URL where the blog is published" <*> option filePath 'u' "site-url" "URL" "URL where the blog is published"
<*> option filePath 'w' "wording" "FILE" "path to the file containing the wording to use" <*> option filePath 'w' "wording" "FILE" "path to the file containing the wording to use"