{- 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) )