Allow custom siteurl/home for locopy
This commit is contained in:
44
locopy/Locopy/CommandLine.hs
Normal file
44
locopy/Locopy/CommandLine.hs
Normal 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)
|
||||
)
|
||||
Reference in New Issue
Block a user