1
0

Allow custom siteurl/home for locopy

This commit is contained in:
2025-12-23 16:45:10 +01:00
parent 071018dce6
commit 4fc36be9dc
9 changed files with 164 additions and 147 deletions

View File

@@ -0,0 +1,44 @@
{- This Source Code Form is subject to the terms of the Mozilla Public License,
v. 2.0. If a copy of the MPL was not distributed with this file, You can
obtain one at https://mozilla.org/MPL/2.0/. -}
module Locopy.CommandLine
( CommandLine(..)
, Wordpress(..)
, commandLine
) where
import Options.Applicative
( Parser
, ParserInfo(..)
, command
, header
, help
, hsubparser
, idm
, info
, long
, metavar
, strOption
)
data Wordpress = Wordpress
{ root :: FilePath
, siteurl :: String
}
newtype CommandLine
= WordpressCommand Wordpress
wordpress :: Parser CommandLine
wordpress = fmap WordpressCommand
$ Wordpress
<$> strOption (long "root" <> metavar "ROOT" <> help "Website configuration directory")
<*> strOption (long "siteurl" <> metavar "HOME" <> help "siteurl and home address")
commandLine :: ParserInfo CommandLine
commandLine = info subcommand (header "locopy (wordpress) [OPTIONS]")
where
subcommand = hsubparser
( command "wordpress" (info wordpress idm)
)